Skip to content

Color Converter (HEX / RGB / HSL)

Convert a colour between HEX, RGB and HSL, with a preview and the WCAG contrast ratio against black and white.

HEX#4f46e5
RGBrgb(79, 70, 229)
HSLhsl(243, 75%, 59%)
Contrast on white6.29:1 · AA
Contrast on black3.34:1 · fails AA

HEX, RGB, HSL — and whether text will be readable on it

Paste a colour in any common notation and get the others, plus a preview. Shorthand hex (#36f), eight-digit hex with alpha, rgb(), rgba(), hsl() and hsla() are all accepted.

The contrast rows apply the WCAG 2 formula against pure white and pure black. A ratio of at least 4.5:1 is required for normal body text, and 3:1 for large text — which decides whether this colour can carry white or black type.

Frequently asked questions

Why choose HSL over HEX?

HSL separates hue from saturation and lightness, so building a palette is a matter of changing one number rather than guessing at hex digits.

What does "fails AA" mean?

The contrast ratio is below the WCAG 2 AA threshold of 4.5:1 for body text, so that combination will be hard to read for many people.

Related tools