#0C8A85rgb(12, 138, 133) · hsl(178, 84%, 29%)rgb(12, 138, 133)hsl(178, 84%, 29%)About Color Converter
Moving colour values between design and front-end work is where formats collide most often: the mock-up specifies hexadecimal, CSS wants RGB or HSL, and building gradients or hover states sends you back to HSL to adjust lightness. A converter lets you move the same colour between several representations instantly instead of hand-converting and mistyping a digit. Each representation has a purpose. Hexadecimal is the common screen notation with two digits each for red, green and blue, 0 to 255 per channel. RGB expresses the same information as three decimal numbers and is convenient for computation. HSL describes hue, saturation and lightness, where hue is an angle from 0 to 360 degrees, which makes adjusting shade or desaturating far more intuitive. Transparency adds a fourth component, usually written as eight-digit hex with the trailing byte as alpha, or as rgba and hsla functions. Practical notes: When producing shades of one hue, changing the HSL lightness component is more reliable than editing hex digits by hand and keeps the hue consistent. For an effect such as slightly darker on hover, hold hue and saturation fixed and move lightness only, so nothing shifts in character. When converting between hex and RGB, watch each channel range, since doing the arithmetic mentally invites mistakes; letting the tool do it is safer. Migrating across gamuts, for instance placing an sRGB colour into a wide-gamut context, needs gamut mapping on top of the numeric conversion, because converting the numbers alone can shift the appearance visibly. Limits: The three-digit shorthand repeats each nibble, which makes a four-digit form like #1234 invalid, and browsers drop the whole declaration silently with neither an error nor a fallback, an easy thing to miss when a style simply does not apply. Named colours number barely more than a hundred, and transparent plus currentColor are keywords rather than colour values: reading computed styles in script resolves the former to an all-zero transparent value and the latter to the current text colour, so handle those two cases separately when comparing colours. Eight-digit hex and rgba order their components in opposite directions, with alpha last in the former, so writing the order wrongly yields a completely different colour; agree on one form per project and write it into the style guide. And neither hex nor RGB carries a colour space, being understood as sRGB by default, so mixing wide-gamut values produces inconsistent results across devices. Data and privacy: colours contain no personal information, which makes this the least privacy-sensitive tool of the group. It still performs every conversion in the browser without issuing requests, so it is safe to use on an internal network or entirely offline. For accessibility and legibility, converting colours is only the first step: text and background contrast must be computed from a luminance formula. The classic light-theme failure is mid-grey text on a pale grey surface whose computed ratio sits just under the threshold. Raise the contrast by adjusting the HSL lightness component and convert back to hex for the stylesheet. The same applies to dark themes, where a naive inversion shifts saturation and hue together and usually looks muddy, so hold the hue, lower saturation and redistribute lightness instead. Maintaining these conversions alongside the design tokens saves substantial rework over time.
How It Works Internally
Hexadecimal gives each channel two hex digits, so every pair after the hash is one channel; RGB carries the same three numbers in decimal; HSL uses a different coordinate system where hue is an angle on the colour wheel and saturation and lightness are proportions, which is why holding hue and moving lightness produces shades of one family. None of the three carries a colour space and all are understood as sRGB.
#0d9488rgb(13, 148, 136) | hsl(175, 84%, 32%)Measured on This Page
| Conversion accuracy | All 18 colours matched the independent implementation for both rgb() and hsl() |
|---|---|
| Round trip | HEX to HSL to HEX returned the exact original colour 18/18 times |
| Fix 1 | Three-digit shorthand #fff used to bypass conversion (preview turned white while RGB/HSL kept the previous colour); now expanded to #ffffff |
| Fix 2 | Invalid HEX now says so explicitly; previously the preview block kept showing the previous colour |
| Contrast edge | #767676 on white is 4.54:1 and passes AA; #777777 is 4.48:1 and fails — one step apart |
| Google, last 90 days | 3 clicks / 17 impressions / average position 25.5 |
WCAG's body-text threshold sits at 4.5:1, and in greys #767676 (4.54:1) just passes while #777777 (4.48:1) just fails. The two are indistinguishable on a design comp but one is compliant and the other is not, so leave about 5% headroom rather than pinning the line. Also note HSL is stored as integers here (H 0-360, S/L 0-100), which should lose precision; all 18 round trips were still exact, so the precision suffices for 8-bit colour — but switching to one decimal place would change the round-trip result, so the two representations are not interchangeable.
How to Use
- Open "Color Converter"
- Enter a HEX value or drag the picker
- Or edit the RGB and HSL components directly
- Review the contrast grade and suggested foreground
- Copy the HEX, RGB or HSL value from its card
Use Cases
- Match the design — Convert a designer HEX into the rgb or hsl value your CSS needs.
- Add transparency — Turn an opaque color into rgba for a translucent overlay or shadow.
- Tweak hue — Use HSL mode to adjust hue and lightness for tints and shades in one family.
- Unify variables — Normalize scattered colors to one format for entering design-system tokens.
- Verify preview — Paste an unknown color value and see the swatch to confirm it is right.
FAQ
Does it support shorthand HEX?
Yes. Three-digit shorthand like #f00 is expanded to #ff0000, and four-digit shorthand with alpha (#f008) is parsed too.
Is precision lost going HEX to HSL?
HEX has only 256 levels per channel, so a round-trip may show a one-unit rounding difference — normal and usually invisible to the eye.
How is transparency expressed?
In RGBA/HSLA, alpha is a 0-to-1 decimal; in 8-digit HEX, the last two hex digits encode opacity, and the tool maps between them automatically.
Are CSS color names supported?
Common named colors (red, rebeccapurple) are usually recognized as input, while output is numeric for precise use.
Will the conversion show a color difference?
The notations describe the same color, so conversion itself has no difference. Perceived differences come from monitor gamut and color profiles, so re-check on the target device.
I just need numeric base conversion.
This tool focuses on color formats. For converting a hex number to decimal and similar, use our base converter.
Why can't I paste oklch() or color(display-p3 ...)?
Because this tool targets standard sRGB color spaces (HEX / RGB / HSL / HSV), while oklch() and the color() function are newer syntax defined in CSS Color 4 that many design files and older browsers still don't support. If your design file supplies Oklab / Oklch or wide-gamut display-p3 values, verify the color in an environment that supports them and then convert to sRGB HEX with a regular tool, or use the sRGB approximation your design file also provides. To simply see what the color looks like, treat the preview swatch as a reference first, then convert to the target format manually.
HEX to HSL looks like a different colour?
Numerically equivalent colours can look different: HEX is sRGB channel values while HSL is a perceptual model, so saturation feels off. Also note HSL in sRGB is entirely different from OKLCH or Display-P3 — confirm you are comparing the same colour space.