WCAG Contrast Checker
Check text and background contrast against WCAG.
Inputs
ExampleHex, for example #767676 or #333.
Result
- Contrast ratio
- 4.54:1
- AA, normal text
- Pass (needs 4.5:1)
- AA, large text
- Pass (needs 3:1)
- AAA, normal text
- Fail (needs 7:1)
- AAA, large text
- Pass (needs 4.5:1)
About this tool
Text needs enough contrast with its background for people with low vision, colour blindness or a bright screen to read it. The Web Content Accessibility Guidelines (WCAG) set minimum ratios. Enter two colours to see their ratio and whether they pass for normal and large text.
- Enter the text colour and the background colour as hex values.
- Read the contrast ratio and the pass or fail result for each level.
- Adjust the colours until they pass the level you need.
Formula
Contrast ratio = (L1 + 0.05) ÷ (L2 + 0.05), where L1 is the relative luminance of the lighter colour and L2 of the darker. AA needs 4.5:1 for normal text and 3:1 for large text; AAA needs 7:1 and 4.5:1.
Worked example
Grey #767676 on white has a ratio of 4.54:1. It passes AA for normal text, because 4.54 is above 4.5, but fails AAA.
Assumptions and limits
- Ratios are compared unrounded against 4.5, 3 and 7, and shown truncated to two decimals, so a displayed 4.49 never hides a pass.
- Large text means at least 24 px regular or about 18.7 px bold.
- Contrast is one part of accessibility. Font weight, size and spacing matter too.
Questions
What is the difference between AA and AAA?
AA is the level most laws and policies require. AAA is stricter and recommended for body text where possible.
Does the order of colours matter?
No. The ratio is always the lighter colour over the darker one.
Why truncate instead of round?
Rounding 4.497 up to 4.50 would suggest a pass that the unrounded ratio does not meet. Truncating avoids that.