Color Contrast Checker
Check whether a text colour and a background colour meet WCAG 2.x contrast requirements. Pick or type two colours and see the exact ratio, pass/fail badges for every WCAG level, and a live preview of how the pair actually looks.
- AA · Normal text (4.5:1)
- AA · Large text (3:1)
- AAA · Normal text (7:1)
- AAA · Large text (4.5:1)
- UI components & graphics (3:1)
Live preview
Normal text (16px) — the quick brown fox jumps over the lazy dog.
Large text, 24px regular
Large text, 18.66px bold
Nothing you type or record is uploaded.
Runs on your device. Nothing you type or record is uploaded. Keeps working without a connection while the page is open. Works with touch. Nothing is saved; reloading resets both colours.
Added
How to use the Color Contrast Checker
- Pick or type the text colour using the swatch or hex field under "Text color".
- Pick or type the background colour the same way under "Background color".
- Read the big contrast ratio and the five pass/fail badges underneath. Each badge is a different WCAG requirement, explained in the table below.
- Check the live preview to see normal text, large text, a button and an input border rendered in the colours you chose.
- If "AA · Normal text" fails, a suggestion box offers the closest passing shade of your text colour (same hue); click "Use this color" to apply it.
- Use "Swap" to test the pair in reverse, or "Reset" for the starting colours.
How the contrast ratio is calculated
The checker uses the formula from WCAG 2.x Success Criterion 1.4.3 (Contrast (Minimum)) and 1.4.11 (Non-text Contrast). Each colour's three 8-bit channels (0–255) are converted to the 0–1 range and "linearized" to undo sRGB gamma encoding:
csrgb = channel ÷ 255
If csrgb ≤ 0.04045, the linear value is
csrgb ÷ 12.92; otherwise it is
((csrgb + 0.055) ÷ 1.055)2.4. Those linear red, green
and blue values are then combined into a single relative luminance using weights that match
how sensitive human vision is to each channel:
L = 0.2126 × R + 0.7152 × G + 0.0722 × B
Finally, the contrast ratio between the lighter colour's luminance (L1) and the darker colour's luminance (L2) is:
ratio = (L1 + 0.05) ÷ (L2 + 0.05)
Before May 2021 the WCAG definition used 0.03928 instead of 0.04045 for that threshold. No 8-bit channel value lies between the two (10/255 is about 0.0392 and 11/255 about 0.0431), so for hex colours both give the same result; this tool uses the current 0.04045. The ratio ranges from 1:1 (identical colours) to 21:1 (black on white) and depends only on lightness, not hue, which is why two very different-looking colours can still fail if their luminance is too close.
Examples
Black text on a white background
#000000 on #ffffff has luminance 0 and 1, so the ratio is
(1 + 0.05) ÷ (0 + 0.05) = 21.00:1. That is the maximum possible
contrast, and it passes every level in the table below.
Two nearly identical greys
#777777 on white comes out to 4.48:1, just under the 4.5:1
AA threshold for normal text, so it fails. Darkening it by a single hex step, to
#767676, raises the ratio to 4.54:1, which passes. That makes
#767676 the lightest neutral grey that passes AA for normal text on white.
A brand blue
This site's own link colour, #2952cc, on a white background computes to
6.62:1. That clears AA for both normal and large text and clears AAA for
large text (4.5:1), but falls short of AAA for normal text (7:1).
WCAG contrast levels at a glance
| Success criterion | Applies to | Minimum ratio |
|---|---|---|
| 1.4.3 Contrast (Minimum), Level AA | Normal text | 4.5:1 |
| 1.4.3 Contrast (Minimum), Level AA | Large text | 3:1 |
| 1.4.6 Contrast (Enhanced), Level AAA | Normal text | 7:1 |
| 1.4.6 Contrast (Enhanced), Level AAA | Large text | 4.5:1 |
| 1.4.11 Non-text Contrast, Level AA | UI components & graphical objects | 3:1 |
What counts as "large" text
WCAG defines large text as at least 18pt (24px) regular weight, or at least 14pt (about 18.66px) bold weight, at standard browser scaling. Large text gets a lower minimum ratio because thicker, wider strokes stay legible at lower contrast than fine body text.
What's exempt from the contrast requirement
- Logotypes. Text inside a logo or brand name has no minimum contrast requirement under Success Criterion 1.4.3.
- Inactive or disabled controls. A greyed-out, disabled button or field is exempt, since it isn't available for the user to act on.
- Pure decoration. Text with no informational value, such as a faint watermark, or text that isn't visible to anyone.
- Incidental text in a photo. Text inside a picture that has other significant visual content is exempt; a heading rendered as an image of text is not.
A note on WCAG 3 and APCA
APCA (Accessible Perceptual Contrast Algorithm) is a newer contrast method that takes font size, font weight and perceived brightness into account more closely than the formula above. The first public WCAG 3 draft (January 2021) used it, but the current WCAG 3 Working Draft (10 September 2026) says its contrast algorithm is yet to be determined, and WCAG 3 is not a finished Recommendation. APCA therefore has no pass/fail thresholds you can cite for compliance. Accessibility audits and the standards that laws point to, such as EN 301 549 in the EU (WCAG 2.1 Level AA) and the US Section 508 standards (WCAG 2.0 Level AA), still use the formula above, which is what this tool implements.
Practical tips for designers
- Don't pair a light grey with a slightly darker grey for body text. Check against the actual page background, not a neighbouring grey element.
- Check hover, focus and visited link states separately; a link that passes at rest often gets a lighter hover tint that quietly drops below 4.5:1.
- Text over a photo needs a solid box, gradient or scrim behind it. Test against the busiest, most contrasting patch of the image, not its average colour.
- Pure black on pure white (21:1) is not required. This site's body text, #14161c, is 18.08:1 on white, still far above the 7:1 that AAA asks for.
Frequently asked questions
What is a good contrast ratio for body text?
Aim for at least 4.5:1 (WCAG AA, Success Criterion 1.4.3) for any normal-sized body text. Reaching 7:1 (AAA) is better for users with low vision, but AA is the level most accessibility audits actually require.
Does this checker work for gradients or photos?
No. It compares two flat colours. For text over a gradient or photo, test against the least favourable point behind the text: the brightest patch if the text is dark, or the darkest patch if the text is light.
Is passing the contrast ratio the same as supporting colour blindness?
No. Contrast ratio only measures lightness difference, not whether two colours are distinguishable to someone with a colour vision deficiency. A red and a green of similar luminance can both pass against the same background yet look alike to a colour-blind user, so never rely on colour alone to convey information (Success Criterion 1.4.1).
Can I use this for buttons and icons, not just text?
Yes. Success Criterion 1.4.11 applies the same 3:1 minimum to the visible boundaries of UI components (borders, outlines, toggle states) and to meaningful graphical objects like icons or chart lines. Enter the component's own colour as "Text color" and whatever it sits on as "Background color".
Sources
- W3C (2024). Web Content Accessibility Guidelines (WCAG) 2.2. W3C Recommendation, 12 December 2024. The relative luminance and contrast ratio formulas, the 0.04045 threshold (0.03928 before May 2021), the definition of large text, the exceptions and the minimum ratios of Success Criteria 1.4.3, 1.4.6 and 1.4.11.
- W3C (2026). W3C Accessibility Guidelines (WCAG) 3.0. Working Draft, 10 September 2026. Its note that the contrast algorithm of WCAG 3 is yet to be determined.
- U.S. Access Board (2017). Revised 508 Standards and 255 Guidelines. Provision E205.4, which requires WCAG 2.0 Level A and AA for electronic content under Section 508.