Developer ToolsWCAG 2.2 contrast

Colour Converter & Contrast Checker

Most colour converters stop at the numbers. This one also computes the WCAG contrast ratio, because the question behind “what is this colour in HSL” is usually “can anyone read text in it”.

Colour

Accepts #2E86DE, 2E86DE, rgb(46,134,222) or hsl(209,72%,53%).

HEX, rgb() or hsl()
HEX
White textBlack text
RGB
HSL
HSV / HSB
CMYK (approx.)
Relative luminance
Closest named colour

Readability (WCAG 2.2)

Contrast with white text
Contrast with black text
Better choice
Normal text (needs 4.5:1)
Large text (needs 3:1)
AAA normal text (needs 7:1)

Why contrast ratio is not brightness difference

WCAG contrast is defined as (L1 + 0.05) / (L2 + 0.05), where L is relative luminance — each channel linearised out of sRGB's gamma curve, then weighted 0.2126 red, 0.7152 green, 0.0722 blue. Those weights reflect how much each primary contributes to perceived brightness, which is why a saturated blue and a saturated yellow of the same numeric “lightness” behave completely differently against white.

The practical consequence: you cannot judge contrast by eye on a bright monitor in a bright room. A mid-blue that looks obviously readable to a designer can fail 4.5:1 and be genuinely hard work for someone with reduced contrast sensitivity.

The thresholds, and what “large text” means

WCAG 2.2 level AA requires 4.5:1 for normal text and 3:1 for large text, where large means at least 18pt (24px) or 14pt (18.66px) bold. Level AAA raises those to 7:1 and 4.5:1. User interface components and meaningful graphics need 3:1 against their surroundings under criterion 1.4.11 — which is why a button border that passes for a graphic can still fail for the label inside it.

HSL is for reasoning, RGB is for rendering

HSL separates hue from saturation and lightness, so “the same blue but 20% lighter” is a single number change rather than three. It is a transform of RGB, not a perceptual model: two colours with identical HSL lightness can look very different in brightness. For palette work that must hold up perceptually, OKLCH is the modern answer; HSL remains far easier to reason about by hand.

CMYK here is an approximation, deliberately

Real CMYK conversion depends on the printing process, paper and ICC profile, and no screen colour maps cleanly onto ink. The values above use the standard naive formula, which is fine for a rough idea and wrong for anything going to press. For print work, convert in software with the correct profile.

Frequently Asked Questions

What contrast ratio do I need to pass WCAG AA?
4.5:1 for normal text and 3:1 for large text — 18pt/24px, or 14pt/18.66px bold. Level AAA requires 7:1 and 4.5:1 respectively.
Why does a colour that looks bright fail the contrast check?
Because relative luminance weights green far more heavily than blue. A saturated blue can be visually striking and still have low luminance, so white text on it may fail while it looks fine to you.
Is the CMYK conversion accurate for printing?
No, and no browser-based converter can be. Accurate CMYK depends on the press, paper and ICC profile. Treat the values as an approximation and convert properly in your print software.
What is relative luminance?
A measure of how bright a colour appears, computed by linearising each sRGB channel and weighting them 0.2126 red, 0.7152 green and 0.0722 blue. It ranges from 0 for black to 1 for white.
Where these numbers come from

Sources

Official publications only. Links open the original document in a new tab.