Color Converter: HEX, RGB, HSL, OKLCH & CMYK

Paste any CSS color or pick one to get every common notation, a WCAG contrast check against white, black and a second color, plus a tints-and-shades palette.

Loading tool…

About the Color Converter

The converter reads everything modern CSS accepts for sRGB colors: #rgb, #rrggbbaa, rgb(52 211 153 / 50%), legacy rgba(52, 211, 153, .5), hsl() with deg, turn or rad hues, hwb(), oklch(), oklab(), the 148 named colors and a bare 52, 211, 153. Every result updates as you type, and alpha is kept across all formats.

OKLCH and OKLab use Björn Ottosson's published matrices, the same model browsers implement for CSS Color 4. Because OKLCH can describe colors outside sRGB, out-of-gamut values are clipped and flagged. CMYK is a naive device conversion without an ICC profile — handy for rough mockups, not for print proofs.

Contrast ratios follow WCAG 2.x relative luminance: 4.5:1 passes AA for body text, 3:1 for large text (24px, or 18.66px bold), and 7:1 passes AAA. Semi-transparent colors are blended over the background first, which is what users actually see. Everything is calculated locally in your browser. Click any tint or shade to load it as the new base color.

How to use it

  1. Type or paste a color in any format, or use the color picker.
  2. Adjust transparency with the alpha slider.
  3. Copy the notation you need from the Formats table.
  4. Enter a background color to check the contrast pair against WCAG AA and AAA.
  5. Click a tint or shade to explore lighter or darker variants.

Frequently asked questions

How do I convert HEX to RGB?
Split the six hex digits into pairs and read each pair as a base-16 number: #34d399 → 34=52, d3=211, 99=153, so rgb(52, 211, 153). Paste the hex value above to get it instantly.
What is OKLCH and why use it?
OKLCH is a perceptual color space: equal changes in lightness (L) look equally different to the eye, unlike HSL. It is supported in all current browsers and makes it easy to build consistent palettes by only varying L or C.
What contrast ratio does WCAG require?
WCAG 2.2 level AA needs at least 4.5:1 for normal text and 3:1 for large text and UI components; level AAA needs 7:1 and 4.5:1.
What does the 8-digit hex code mean?
#rrggbbaa adds an alpha channel: the last two digits are opacity from 00 (transparent) to ff (opaque). #34d39980 is about 50% opacity.

Related tools