By Tim King · Updated
WCAG Contrast Checker
Text and Background Ratio Against AA and AAA
OneTask is free, with no sign-up, and built by one person.
If this tool saved you time, a coffee helps keep new ones coming.
How the Contrast Checker works
This WCAG contrast checker tests a colour pair against the AA and AAA rules. Pick a text colour and a background colour and get the contrast ratio, whether it passes WCAG 2.2 at AA and AAA for the size of text you are using, and the APCA lightness contrast score that the draft of WCAG 3 is built around. Nothing is uploaded and the numbers update as you drag.
WCAG contrast checker: AA and AAA thresholds
Contrast is the accessibility requirement that gets checked most and understood least. The number everyone quotes — 4.5:1 — is one threshold from one formula, and the formula has known problems that the people who wrote it have spent years replacing.
How the WCAG ratio is calculated. Each colour is converted to a relative luminance between 0 and
1, using a piecewise curve that linearises the sRGB gamma, then weighting red, green and blue by
0.2126, 0.7152 and 0.0722 because the eye is far more sensitive to green than to blue. The ratio is
(lighter + 0.05) / (darker + 0.05), which runs from 1:1 for two identical colours to 21:1 for pure
black on pure white. The 0.05 term is a fudge for ambient screen glare, and it is where most of the
formula's inaccuracy lives.
The thresholds depend on the size of the text. AA wants 4.5:1 for body text and 3:1 for large text, where large means 24px, or 18.66px if it is bold. AAA raises those to 7:1 and 4.5:1. A separate 3:1 rule covers non-text things that carry meaning: input borders, focus rings, icons, chart series. Meeting AA on your body copy while your form fields have a barely visible outline is one of the most common audit findings there is.
Why APCA exists. The WCAG formula treats a pair of colours symmetrically, so dark-on-light and light-on-dark score identically. Human vision does not work that way — light text on a dark background needs more separation to read as comfortably, an effect that gets stronger as text gets thinner. The WCAG formula also badly overrates contrast in the dark end of the range, which is why mid-grey on black can pass 4.5:1 and still be genuinely hard to read. APCA models perceived lightness contrast instead, is polarity-aware, and returns an Lc value from roughly -108 to 106.
Reading an Lc number. Around Lc 90 is safe for any text including thin weights, Lc 75 is a reasonable floor for 16px body copy, Lc 60 suits larger or bolder body text, Lc 45 is headline territory and Lc 30 is the floor for borders and icons. The sign tells you the polarity: negative means light text on a dark background. APCA is not yet normative anywhere, so treat it as the better guide to how the text will actually read while continuing to ship the WCAG ratio your audit asks for.
Contrast is necessary, not sufficient. A page can pass every ratio and still be unreadable because the line length is too long, the font is too light, the letter spacing is too tight, or the text sits over a photograph whose brightness varies. Contrast checkers measure two flat colours; real interfaces have gradients, translucency and images behind their text, and each of those needs checking at its worst point rather than its average.
Contrast of greys on white
Grey body text on #ffffff.
WCAG contrast ratio and AA and AAA result for grey text on white
| Text colour | Ratio | AA | AAA |
|---|---|---|---|
| #000000 | 21.00:1 | Pass | Pass |
| #111111 | 18.88:1 | Pass | Pass |
| #222222 | 15.91:1 | Pass | Pass |
| #333333 | 12.63:1 | Pass | Pass |
| #444444 | 9.74:1 | Pass | Pass |
| #555555 | 7.46:1 | Pass | Pass |
| #5b6472 | 5.98:1 | Pass | Fail |
| #666666 | 5.74:1 | Pass | Fail |
| #6b6b6b | 5.33:1 | Pass | Fail |
| #707070 | 4.95:1 | Pass | Fail |
| #767676 | 4.54:1 | Pass | Fail |
| #777777 | 4.48:1 | Fail | Fail |
| #808080 | 3.95:1 | Fail | Fail |
| #888888 | 3.54:1 | Fail | Fail |
| #949494 | 3.03:1 | Fail | Fail |
| #999999 | 2.85:1 | Fail | Fail |
| #a0a0a0 | 2.61:1 | Fail | Fail |
| #aaaaaa | 2.32:1 | Fail | Fail |
| #bbbbbb | 1.92:1 | Fail | Fail |
| #cccccc | 1.61:1 | Fail | Fail |
| #dddddd | 1.36:1 | Fail | Fail |
Contrast ratio formula and worked examples
The formula: contrast ratio = (L1 + 0.05) ÷ (L2 + 0.05), where L1 is the relative luminance of the lighter colour and L2 that of the darker one. Relative luminance is 0.2126 R + 0.7152 G + 0.0722 B after each sRGB channel is linearised, so the ratio runs from 1:1 for identical colours to 21:1 for black on white.
First example. #767676 text on white has a ratio of 4.54:1, which is the lightest neutral grey that passes AA for normal text (4.5:1). One step lighter, #777777, gives 4.48:1 and fails.
Second example. white text on #0066cc blue gives 5.57:1, which passes AA for normal text but not AAA at 7:1. Darkening the blue to #004c99 lifts it to 8.42:1 and passes AAA.
How many to one do you need? AA needs 4.5:1 for normal text and 3:1 for large text (24 px, or 18.66 px bold) and for user-interface components. AAA needs 7:1 for normal text and 4.5:1 for large text.
FAQ
What contrast ratio do I actually need?
4.5:1 for ordinary body text and 3:1 for large text to meet WCAG 2.2 level AA, which is what most legislation references. Level AAA raises those to 7:1 and 4.5:1. Interface elements such as input borders, focus indicators and icons need 3:1 against their surroundings.
What counts as large text?
Text at 24px or larger, or 18.66px or larger if it is bold. Those thresholds come straight from the specification and are the reason a heading can use a colour that would fail on the paragraph underneath it, which surprises people during audits.
Why does APCA disagree with the WCAG ratio?
Because they measure different things. The WCAG formula is symmetrical and compresses the dark end of the range, so it overrates dark backgrounds; APCA models perceived lightness contrast and accounts for polarity, so light-on-dark and dark-on-light score differently as they do in real reading.
Should I use APCA instead of WCAG?
Not yet, if you have a legal or contractual obligation. APCA is the research behind the draft WCAG 3 guidelines and is not normative anywhere today. The practical approach is to pass the WCAG ratio you are required to meet and use the Lc score to choose between colours that all pass.
Does contrast apply to disabled buttons and placeholder text?
Disabled controls are exempt from the contrast requirements, but placeholder text is not, because it is real text that users have to read. Relying on a low-contrast placeholder to label a field fails on both contrast and on the placeholder disappearing the moment someone types.
See also: all Colour tools, Layout & Spacing, Shadows & Motion, Shapes & SVG, UI Components, Forms & Inputs.
Related tools
Luminance Scorer
Score many colour pairs for contrast at once.
CSS Text Shadow Generator
Visual text-shadow builder with drop, long, neon and outline presets.
Colour Palette Generator
Generate a full UI palette with light and dark modes from one colour.
Colour Picker
Pick a colour and copy it in every CSS format at once.
Complementary Colour Generator
Find a colour's complement with tints, shades and copyable CSS.