Convert a color between HEX, RGB, and HSL formats — enter a color in whichever format you have, and see it instantly converted to the other two, with a live preview swatch.
HEX, RGB, and HSL all describe the same color in different ways. HEX and RGB both encode red, green, and blue directly (HEX in base-16, RGB in base-10); HSL instead describes hue, saturation, and lightness. Converting between them uses standard, well-defined formulas.
Every color on a screen is ultimately made of red, green, and blue light mixed together — HEX and RGB both describe this mix directly, just in different number systems. HSL takes a more human-friendly approach: instead of thinking in terms of red/green/blue amounts, it describes a color by its hue (the base color on a color wheel), saturation (how vivid or muted it is), and lightness (how close to black or white it is). Designers often find HSL more intuitive for tasks like "make this a bit darker" or "same color, less saturated" — adjustments that are awkward to reason about directly in RGB or HEX.
Example: #6C3FC7 splits into RR=6C, GG=3F, BB=C7, which convert from base-16 to base-10 as R=108, G=63, B=199.
RGB values are first normalized to a 0–1 range, then lightness is the average of the max and min channel values, saturation depends on how far apart the max and min channels are, and hue is derived from which channel (R, G, or B) is dominant. The exact formula is more involved than a single line, but the calculator above handles it directly.
| Format | Example | Meaning |
|---|---|---|
| 6-digit HEX | #FF0000 | Full red, no green, no blue |
| 3-digit shorthand | #F00 | Shorthand for #FF0000 (each digit doubled) |
| RGB | rgb(255, 0, 0) | Same color in decimal RGB |
| HSL | hsl(0°, 100%, 50%) | Same color in hue/saturation/lightness |
Example — Brand color to CSS variable: A brand's primary purple, RGB(108, 63, 199), converts to #6C3FC7 for use directly in a CSS file or design tool.
Example — Building a shade scale: Starting from HSL(261°, 55%, 51%), keeping hue and saturation fixed while stepping lightness from 20% to 80% in increments produces a consistent set of shades of the same color — a common technique for generating a design system's color palette.
Example — Checking a design spec: A designer hands off "hsl(220, 70%, 50%)" but your codebase uses HEX values — converting it gives #267ACC, ready to paste into CSS.
What's the difference between HEX and RGB? They describe the exact same red/green/blue values — HEX uses base-16 (hexadecimal) notation like #FF0000, while RGB uses base-10 numbers like rgb(255, 0, 0).
What does HSL stand for? Hue, Saturation, and Lightness — a way of describing color that's often more intuitive for humans than raw RGB values.
How do I make a color darker without changing its hue? Lower the Lightness value in HSL while keeping hue and saturation the same — this darkens the color without shifting which color it fundamentally is.
What is 3-digit HEX shorthand? A shorthand like #F00 where each digit is doubled to expand to the full 6-digit form — #F00 becomes #FF0000.
Why would I use HSL instead of HEX? HSL makes it easier to reason about adjustments like 'more saturated' or 'a bit darker' since those map directly to one HSL value, unlike HEX or RGB where such changes affect all three numbers.
Is HSL lightness the same as brightness? Not exactly — HSL lightness of 50% gives the purest version of a hue, while both 0% and 100% always produce black and white regardless of hue, which differs from how 'brightness' works in other color models.
Can I convert HSL directly to HEX? Yes — this calculator converts HSL to RGB internally first, then RGB to HEX, giving you both results from a single HSL input.
What's a common use case for this converter? Converting a color a designer specifies in one format (like HSL from a design tool) into the format your code actually needs (like HEX for CSS).
Does saturation or lightness change first when I adjust a color? They're independent — saturation controls how vivid vs. gray a color is, and lightness controls how close to black or white it is, and you can adjust either without affecting the other.