KKwikfig.

Contrast Checker

Check text and background colour pairs against WCAG contrast rules — the exact ratio plus pass or fail for AA and AAA, normal and large text, live as you pick. Runs entirely in your browser — your numbers never leave this device.

Contrast ratio
4.48 : 1
WCAG relative-luminance formula — 1:1 is identical colours, 21:1 is black on white
AA normal text (4.5): Fail ✗AA large text (3.0): Pass ✓AAA normal text (7.0): Fail ✗AAA large text (4.5): Fail ✗

Normal text: the quick brown fox jumps over the lazy dog.

Large text: the quick brown fox.

Large text means at least 24 px, or 18.66 px and bold, in WCAG terms. The ratio is symmetric — swapping text and background colours changes nothing — because it only compares the two luminances.

How it works

Per channel: c = channel ÷ 255; linear = c ÷ 12.92 if c ≤ 0.03928, else ((c + 0.055) ÷ 1.055)^2.4 | Luminance L = 0.2126R + 0.7152G + 0.0722B on the linearised channels | Ratio = (Llighter + 0.05) ÷ (Ldarker + 0.05), from 1:1 to 21:1
WCAG 2.x contrast thresholds — the grades this checker reports
LevelNormal textLarge textMeans
AA4.5 : 13 : 1The standard most sites are required or expected to meet
AAA7 : 14.5 : 1The enhanced tier — recommended for long-form reading
Large text (definition)—24 px, or 18.66 px boldText at or above this size is graded at the large-text thresholds
Non-text (UI components, icons)3 : 13 : 1WCAG asks 3:1 for meaningful graphics and control boundaries

Contrast is not how different two colours look — it is a defined computation. Each sRGB channel is first linearised (computer values are gamma-encoded, so raw bytes must be un-bent with the piecewise formula above), then combined into a relative luminance weighted toward green, because human vision is. The ratio of the two luminances, with 0.05 added to both to model viewing flare, runs from 1:1 for identical colours to 21:1 for black on white. This checker does that arithmetic exactly and grades the pair against all four WCAG thresholds at once.

The thresholds in the table are the WCAG 2.x success criteria: AA is the level most accessibility law and procurement points at, AAA is the stricter tier. Large text gets lower thresholds because thick strokes survive low contrast better; WCAG counts text as large at 24 px, or 18.66 px (14 pt) and bold. The one-step cliff is real and worth seeing once: on white, #777777 scores 4.48 and fails AA for normal text, while one step darker at #767676 scores 4.54 and passes — the checker updates live so you can hunt a boundary like that by eye.

Note what the ratio ignores: it is symmetric (text and background are interchangeable to the formula), it says nothing about hue, and it flattens the difference between a colour pair and its reverse. It is a floor for legibility, not a design judgement — two palettes can both pass AA and read completely differently.

Worked examples

The maximum: black on white

Input
Text = #000000, Background = #ffffff
Working
Black's luminance is 0 and white's is 1, so the ratio is (1 + 0.05) ÷ (0 + 0.05) = 21 — the ceiling of the scale, and the only pair that reaches it. Every grade passes.
Result
21.00 : 1 — AA normal ✓, AA large ✓, AAA normal ✓, AAA large ✓

The famous boundary grey

Input
Text = #777777, Background = #ffffff
Working
#777777 linearises to a luminance of about 0.184, giving (1.05) ÷ (0.234) ≈ 4.48 — just under the 4.5 AA line for normal text. Darken one step to #767676 (luminance ≈ 0.181, ratio ≈ 4.54) and it passes.
Result
4.48 : 1 — AA normal ✗, AA large ✓, AAA normal ✗, AAA large ✗ (#767676 scores 4.54 and passes AA normal)

A mid blue on white

Input
Text = #3366cc, Background = #ffffff
Working
The blue's luminance is about 0.146, so the ratio is 1.05 ÷ 0.196 ≈ 5.37. Comfortably past AA for text of any size, short of AAA's 7:1 for normal text — a typical 'good link colour' profile.
Result
5.37 : 1 — AA normal ✓, AA large ✓, AAA normal ✗, AAA large ✓

Frequently asked questions

Which level should I aim for, AA or AAA?

AA is the conformance level written into most law, procurement rules and platform guidelines, so it is the practical target: 4.5:1 for body text, 3:1 for large text. AAA (7:1 / 4.5:1) is worth reaching for long-form reading content when the palette allows it, but WCAG itself notes AAA cannot be met for every colour combination, and failing AAA is not failing accessibility.

Why do two colours that look very different score badly?

Because the formula sees only luminance, not hue. A saturated red and a saturated green can be equally bright — nearly the same linearised luminance — and score close to 1.5:1 despite being obviously different colours to most eyes (and indistinguishable to some colour-blind readers). Distinctness is not contrast; the worked grey examples show the formula grading shades most people can barely tell apart as pass and fail.

Is the ratio the same if I swap text and background?

Yes — the formula always divides the lighter luminance by the darker, so the pair (#777777, #ffffff) scores 4.48 in both directions and both directions fail AA for normal text by the same hair. Readability in practice can differ (light text on dark backgrounds suffers halation for some readers), but the WCAG number is deliberately symmetric.

What counts as large text?

At least 24 px in CSS pixels, or at least 18.66 px (the pixel equivalent of 14 pt) when bold. Headlines and big UI labels usually qualify; button text at 16 px bold does not — it needs the full 4.5:1 for AA. The preview in the widget shows both sizes so you can see which grade your actual text falls under.

Does a passing ratio guarantee my text is accessible?

It guarantees one criterion. Font size, weight, line length, and the fact that colour alone must not carry meaning (a red/green status difference needs a label or icon too) are separate criteria the ratio cannot see. Treat 4.5:1 as the floor of a legible design, not its certificate.

Related tools

More in Developer Tools · Browse all tools