Instantly convert a hex color code to RGB and HSL, with a live color preview.
Last updated: November 14, 2026
What are hex, RGB, and HSL color formats?
Hex color codes are the most common color representation in web design: a 6-digit code starting with # (e.g. #6366F1) that expresses the red, green, and blue components as two-digit hexadecimal numbers. RGB (Red, Green, Blue) represents the same information as three decimal numbers ranging from 0 to 255. HSL (Hue, Saturation, Lightness) expresses color as a hue angle (0-360 degrees), saturation percentage (0-100%), and lightness percentage (0-100%), making it more intuitive for designers to adjust.
Short 3-digit hex codes (e.g. #fff) are expanded to a 6-digit code by repeating each digit (#fff becomes #ffffff).
Short answers to common questions
They both express the same color in different ways. Hex packs the color into a single 6-digit hexadecimal code (#6366F1), while RGB shows the red, green, and blue components separately as decimal numbers from 0 to 255 (rgb(99, 102, 241)). They represent the same color, just in different notations.
Short codes like #fff are expanded into a 6-digit code by repeating each digit twice: #fff becomes #ffffff. This is a shorthand notation available for certain colors.
HSL is very useful when you want to adjust a color's brightness or saturation while keeping its hue, since you only need to change one value (lightness or saturation). This is much more intuitive than recalculating three values at once in hex or RGB.
More tools for similar calculations