The web describes the same color in several notations. A color converter translates between them instantly so you can grab a value from a design tool in one format and drop it into your code in another. This guide explains HEX, RGB, and HSL, how they relate, and which to choose.
HEX
A HEX code writes a color as a hash followed by six hexadecimal digits, two each for red, green, and blue: #RRGGBB. Each pair ranges from 00 to FF (0 to 255 in decimal). HEX is compact and is the most common way to paste a single fixed color into CSS.
RGB
RGB lists the same three channels as decimal numbers from 0 to 255, like rgb(99, 102, 241). It is easier to read at a glance and, with the rgba() form, adds a fourth value for opacity from 0 (transparent) to 1 (opaque).
HSL
HSL describes a color by hue (an angle from 0 to 360 on the color wheel), saturation (a percentage), and lightness (a percentage): hsl(239, 84%, 67%). Because you adjust one intuitive property at a time, HSL is excellent for building palettes — nudge lightness for a tint or shade, or shift hue for a related color. The hsla() form adds opacity too.
A worked conversion
All three of these describe the exact same indigo:
The HEX pairs 63, 66, and f1 convert to the decimals 99, 102, and 241, which is the RGB triplet. Recomputing that in terms of hue, saturation, and lightness gives the HSL value.
When to use each
- HEX — pasting a single brand color into CSS or a design file.
- RGB / rgba — when you need transparency or are setting channels from code.
- HSL / hsla — building palettes and generating tints, shades, and hover states by tweaking one value.
How to use the color converter online
- Enter a color in any format, or pick one.
- Read the equivalent HEX, RGB, and HSL values.
- Copy the format your project needs.
FAQ
Q: What is HSL good for?
A: Building and adjusting palettes. Because hue, saturation, and lightness are independent, you can make tints, shades, and related colors by changing a single number.
Q: What is the difference between HEX and RGB?
A: They express the same red, green, and blue channels — HEX in hexadecimal after a hash, RGB in decimal from 0 to 255. RGB is easier to read; HEX is more compact.
Q: How do I add transparency?
A: Use the alpha channel: rgba() or hsla() take a final value from 0 (fully transparent) to 1 (fully opaque). Modern CSS also allows an alpha on HEX with eight digits.