Skip to content

Color converter (HEX, RGB, HSL, CMYK)

HEX, RGB, HSL and CMYK in one place, with tints and shades and the contrast ratio for accessible text.

Runs in your browser. Nothing you paste is sent anywhere.
Text in this color on white
Text in this color on black

How it works

HEX → RGB → HSL / CMYK

A HEX code is three two-digit base-16 numbers: red, green and blue from 0 to 255. Everything else is worked out from those three. HSL describes the same color as a hue angle, a saturation and a lightness; CMYK is the ink mix a printer would start from (real print colors depend on the paper and press profile).

  1. HEX to RGB: each pair in base 16 EA = 14 × 16 + 10 = 234
  2. RGB to HSL (values as 0–1) L = (max + min) ÷ 2
  3. RGB to CMYK K = 1 − max
  4. Contrast ratio (WCAG 2.2) (L1 + 0.05) ÷ (L2 + 0.05)

Good to know

  • WCAG asks for 4.5 : 1 for normal text (AA), 7 : 1 for AAA, and 3 : 1 for large text (24 px, or 18.5 px bold).
  • Click any tile to copy it, or a tint or shade to switch to it.