Color converter: HEX, RGB, HSL, OKLCH and contrast

Convert a color between HEX, RGB, HSL, HSV, CMYK and OKLCH and check its WCAG contrast against white and black.

HEX

#3451d1

RGB

rgb(52 81 209)

HSL

hsl(229 63% 51%)

HSV

hsv(229, 75%, 82%)

CMYK

cmyk(75%, 61%, 0%, 18%)

OKLCH

oklch(49.5% 0.199 268.2)

WCAG text contrast

AaOn white: 6.47:1 — passes for normal text (AA)
AaOn black: 3.24:1 — large text only (AA)
AaOn #fff4e5: 5.95:1 — passes for normal text (AA)

How to use

Enter a color in any format — #3451d1, rgb(52 81 209), hsl(229 63% 51%) or oklch(51% 0.2 268) — or pick one. You’ll see the same color in every format and how readable it is on white and black.

Formats

WCAG contrast

For accessible text, foreground and background must differ enough. WCAG 2.x requires:

To check contrast against your own background (say, text on a colored banner), enter the background color in the field below the checks or pick it.

For example, #777777 on white is 4.48:1 — just short of the AA minimum for normal text.

FAQ

Why does an OKLCH color sometimes change when converted to HEX? Some OKLCH colors fall outside the sRGB gamut; they’re mapped to the nearest displayable color.