What this tool does
Paste or pick any CSS color and see it in HEX, RGB, HSL, HWB, LAB, LCH and OKLCH, each with its own copy button. A swatch and an alpha slider show how the color looks with transparency. Below the converter, a contrast checker compares two colors against the WCAG 2 thresholds and previews sample text in them.
Color models, briefly
- HEX and RGB describe a color as amounts of red, green and blue (0–255, or 0–100%).
- HSL adds hue, saturation and lightness, which is often easier to reason about than raw RGB.
- HWB (hue, whiteness, blackness) mixes white and black into a hue — handy for tints and shades.
- LAB and LCH describe color the way human vision perceives lightness (L) together with either green–red/blue–yellow axes (LAB) or chroma and hue (LCH).
- OKLCH is a newer, perceptually uniform version of LCH built for the modern web.
Why OKLCH is useful
In HSL, keeping “lightness” at the same number while changing the hue can still look much lighter or darker to the eye — pure yellow at L = 50% looks far brighter than blue at the same L. OKLCH’s lightness channel tracks how bright a color actually looks, so palettes built by adjusting only the lightness value stay visually consistent across hues, and you can change a color’s saturation without accidentally changing how light or dark it appears.
How WCAG contrast is computed
The contrast checker follows the WCAG 2 formula: it computes the relative luminance of each color (a weighted mix of its linear-light red, green and blue channels), then divides (L1 + 0.05) by (L2 + 0.05), using the lighter color as L1. The result is a ratio such as 4.5:1.
- AA, normal text: 4.5:1
- AA, large text: 3:1
- AAA, normal text: 7:1
- AAA, large text: 4.5:1
“Large text” means at least 18pt (about 24px) at regular weight, or 14pt bold (about 19px).
Out-of-gamut colors
LAB, LCH and OKLCH can describe colors that no ordinary screen can show, because they cover a wider range than sRGB. When that happens, this tool tells you and shows the closest color your sRGB display can reproduce for HEX and RGB.