WCAG Contrast Checker

Check text and background colours against WCAG 2 AA and AAA and the APCA draft for WCAG 3, see the pair in real text sizes, and get the smallest colour change that passes.

Checker Color & Design Updated Oct 3, 2026
Learn how this works
How to Use
  1. Enter the text colour and the background colour in any CSS format, or use the pickers. Semi-transparent text is blended onto the background first, as WCAG requires.
  2. Read the contrast ratio and the pass or fail badges for AA, AAA, large text and interface elements, and the APCA value.
  3. Check the samples, which show the pair at body, large, small and button sizes.
  4. Choose the level you need and press Fix text or Fix background to get the closest colour that passes, keeping its hue.
Input
any CSS colour
used by the fix buttons
Presets
Contrast
Ratio
—
AA text
—
AAA text
—
APCA Lc
—

Worked Example

Grey text #777777 on white.

Each channel is 0x77 = 119, or 119 ÷ 255 = 0.4667. Undoing the screen gamma: ((0.4667 + 0.055) ÷ 1.055)2.4 = 0.1845. All three channels are equal, so the relative luminance is 0.1845. White’s is 1.

Ratio = (1 + 0.05) ÷ (0.1845 + 0.05) = 1.05 ÷ 0.2345 = 4.48 : 1 — just under the 4.5 : 1 that AA needs for normal text, so it fails (it passes for large text, which needs 3 : 1). Fix text finds #767676, one step darker, at 4.54 : 1.

Show Work

Enter two colours above to see the calculation.

Formulas

Relative luminance
L = 0.2126R + 0.7152G + 0.0722B
On linearised channels
Contrast ratio
(L1 + 0.05) / (L2 + 0.05)
L1 the lighter colour; 1 : 1 to 21 : 1
AA
4.5 text · 3 large · 3 UI
AAA
7 text · 4.5 large
Transparency
c = α·text + (1 − α)·background
Blended before measuring
APCA Lc
1.14·(Ybg0.56 − Ytxt0.57)
Dark text on light; reversed polarity uses 0.65 / 0.62

Where the 4.5 : 1 Rule Came From

WCAG 2.0, published by the W3C in 2008, set the contrast ratios still used today. The 4.5 : 1 figure compensates for the loss of contrast sensitivity typical of vision around 20/40, roughly what a person in their eighties has; 7 : 1 covers vision around 20/80. The formula itself comes from the sRGB standard’s luminance weights, which reflect how much each colour of light contributes to brightness.

Researchers, notably Andrew Somers, showed that the WCAG 2 formula misjudges some pairs — it rates many dark-mode combinations and orange-on-white too generously or too harshly. APCA, his perceptual model, is the candidate method for WCAG 3, which is still a working draft; until it is final, WCAG 2 remains the legal reference.

About This Tool

This tool reads any CSS colour for text and background, blends semi-transparent text onto the background, and reports the WCAG 2 contrast ratio with pass or fail for AA, AAA, large text and interface parts, alongside the APCA Lc value. The samples show the pair at real sizes.

The fix buttons search OKLCH lightness for the closest colour that reaches your chosen level, keeping its hue and as much chroma as fits, and report how much the colour changed. Everything runs in your browser.

Related tools: Color Blindness Simulator, CSS Variables Generator, and Universal Color Converter.

Frequently Asked Questions

What contrast ratios does WCAG require?

WCAG 2.1 and 2.2 level AA: 4.5:1 for normal text and 3:1 for large text and for interface parts such as icons, input borders and focus rings. Level AAA: 7:1 for normal text and 4.5:1 for large text. AA is the level most laws and policies refer to, including the ADA, Section 508 and the European Accessibility Act.

What counts as large text?

At least 18 point regular or 14 point bold, which is about 24 px regular or 18.66 px bold in CSS. Everything smaller is normal text and needs 4.5:1 for AA.

How is the ratio calculated?

Each colour’s relative luminance is worked out from its linearised red, green and blue (0.2126R + 0.7152G + 0.0722B). The ratio is (lighter + 0.05) ÷ (darker + 0.05), from 1:1 for identical colours to 21:1 for black on white. Show Work below does it step by step for your colours.

What is APCA?

The Accessible Perceptual Contrast Algorithm, being developed for WCAG 3. It gives a lightness contrast value, Lc, from about −108 to +106, where the sign shows polarity: positive for dark text on a light background, negative for light text on dark. It models how we see better than WCAG 2, especially for dark themes and saturated colours. Rough guides: 75 or more for body text, 60 for large text, 45 for non-text. It is not yet a legal standard.

Why does #777 fail when it looks fine?

Mid greys sit right at the edge: #777777 on white is 4.48:1, just under 4.5:1. #767676, one step darker, is 4.54:1 and passes. Many people see either easily on a good screen, but the threshold exists for low vision, glare, cheap displays and older eyes.

How do I use the WCAG Contrast Checker?

Just type your numbers. The answer shows up right away — there is no button to press. Change anything and it updates by itself.

Is it free? Does it work without internet?

Yes to both. It is free with no sign-up, and once the page has loaded it keeps working even with no internet.

Where does my data go?

Nowhere — every calculation runs on your own device. Nothing you enter is uploaded, logged, or stored.

Common Use Cases

Body text and links

Check that grey body text and blue links reach 4.5:1: Tailwind’s blue-500 #3B82F6 on white is only 3.68:1, so links need blue-600 or darker.

Buttons

White on a brand colour: find the lightest shade that still gives white text 4.5:1, using Fix background.

Dark mode

APCA shows when light-on-dark text is weaker than its WCAG 2 ratio suggests.

Interface parts

Input borders, icons and focus rings need 3:1 against the background next to them; a light grey border like #E5E7EB on white is only 1.2:1.

Last updated: