Color Contrast Checker WCAG AA & AAA Compliance
Test any foreground and background colour combination for WCAG 2.1 accessibility compliance. See contrast ratios, pass/fail for AA and AAA, a live preview, and automatic fix suggestions.
Normal text (16px) — The quick brown fox jumps over the lazy dog.
Large text (24px bold) — Sample heading
Contrast is not a matter of opinion, it is four lines of arithmetic
Designers argue about whether grey text on white is readable. The Web Content Accessibility Guidelines settled it with an equation. This tool runs that equation against the two colours you enter, with no approximation and no API call, and reports a number you can take to an audit.
The scale, and where the lines fall
Twenty one to one is the ceiling. Pure black on pure white, nothing scores higher. Most real interface work lives between 3:1 and 8:1, which is why the interesting part of the scale is compressed into its left half.
That last swatch is the one worth staring at. White on yellow looks like a reasonable design choice and scores 1.4:1, barely above invisible. Luminance is not brightness as your eye reports it, which is exactly why the formula exists.
From hex to verdict, in four steps
#fff, are normalised and split into red, green and blue channels from 0 to 255.Everything else on the results card, the badges, the meter, the suggested fixes, is presentation wrapped around those three functions. The 2.4 exponent and the 0.055 offset are not arbitrary constants; they come from the IEC 61966-2-1 sRGB standard that defines how your monitor interprets a hex value.
The thresholds, and which one applies to you
| Level | Applies to | Minimum |
|---|---|---|
| AA | Normal body text | 4.5:1 |
| AA | Large text, 18pt or 14pt bold and above | 3:1 |
| AA | Icons, borders, form field outlines, focus rings | 3:1 |
| AAA | Normal body text | 7:1 |
| AAA | Large text | 4.5:1 |
AA is the level nearly every accessibility law and procurement standard references, including EN 301 549 in the EU and Section 508 guidance in the United States. AAA is stricter and generally reserved for content where failure has consequences, such as government forms, medical instructions or emergency information.
The large text exemption catches people out. It is not about visual weight, it is a specific size threshold: 18 point, roughly 24 pixels, or 14 point bold, roughly 18.66 pixels. A heading at 20 pixels regular is still normal text and still needs 4.5:1.
How the fix suggestions are generated
When a pair fails, the tool proposes two routes rather than one, because they suit different situations.
| Suggestion | Method | When to use it |
|---|---|---|
| Nudge by 40 | Push the lighter colour further from the darker by 40 per RGB channel, recompute, and only offer it if the ratio actually improved | Keeping brand colour recognisable |
| Black or white | Compute against pure black and pure white text | Fastest fix, and shows the ceiling available without touching the background |
A note on WCAG 3 and APCA
The current formula has known weaknesses. It handles dark mode poorly, treats all hues as equivalent, and can pass combinations that read badly in practice. The draft APCA algorithm being developed for WCAG 3 models perceptual contrast rather than a simple luminance ratio, and produces quite different verdicts on light text over mid tones. It is not yet normative. Until it is, 4.5:1 remains the number auditors and courts reference, so that is what this tool reports.
WCAG references
- Success Criterion 1.4.3, Contrast Minimum is the AA requirement itself, with the reasoning behind the ratio.
- W3C relative luminance definition gives the exact formula implemented above.
- Success Criterion 1.4.11, Non-text Contrast covers the 3:1 requirement for icons and interface components, which is widely missed.
- WebAIM Contrast Checker is the most cited reference implementation of the same maths, useful for cross checking a result.
- WCAG 2.2 is the current published guideline set.
- Colour Contrast Analyser from TPGI, if you need to sample colours off screen rather than type hex values.
Accessibility work this supports
Checking button and link colours before a design ships, auditing existing text on background pairs ahead of a compliance review, picking a readable caption colour over a photograph, verifying that a dark mode palette clears the same bar as its light counterpart, and settling the recurring internal argument about whether light grey placeholder text is legal. Design system teams typically run every token pair through this once, then bake only the passing combinations into the component library so the question never comes up again.
FAQ: Color Contrast Checker
WCAG stands for Web Content Accessibility Guidelines, published by the W3C. Contrast requirements exist because users with low vision, colour blindness, or ageing eyes have difficulty reading text that does not stand out sufficiently from its background. WCAG 2.1 Level AA requires a contrast ratio of at least 4.5:1 for normal text and 3:1 for large text. Level AAA requires 7:1 and 4.5:1 respectively. These thresholds are derived from research on the contrast sensitivity function of the human visual system and represent the minimum contrast at which text remains legible for most users with moderate visual impairments.
The contrast ratio uses relative luminance, which measures the perceptual brightness of a colour on a scale from 0 (absolute black) to 1 (absolute white). Each sRGB colour component (R, G, B in 0 to 255 range) is first normalised to 0 to 1, then gamma expanded to linear light using the formula: if c ≤ 0.04045, linear = c/12.92; else linear = ((c+0.055)/1.055)^2.4. Relative luminance is then L = 0.2126R + 0.7152G + 0.0722B, with the green channel weighted most heavily because human eyes are most sensitive to green light. Contrast ratio = (L1 + 0.05) / (L2 + 0.05) where L1 is the lighter colour.
WCAG defines large text as at least 18 pt (24 px) for normal weight, or at least 14 pt (approximately 18.66 px) for bold text. This larger threshold applies because bigger text is inherently easier to read at lower contrast due to the increased character width. The 3:1 ratio for large text (AA) and 4.5:1 (AAA) are correspondingly relaxed compared to normal text requirements. In practice, check which threshold applies based on the rendered font size and weight at the breakpoint where the text appears.
Colour blindness (colour vision deficiency) affects approximately 8% of men and 0.5% of women. The most common type is red green colour blindness (deuteranopia or protanopia), in which the red and green channels are difficult to distinguish. WCAG contrast ratios are calculated from luminance (perceived brightness), not hue, which means a passing contrast ratio generally works for colour blind users, it is pure colour differentiation (red green, for example) that they cannot rely on. Using contrast ratio as your primary accessibility metric is therefore the right approach; never rely on colour alone to convey information.
The 4.5:1 ratio applies to text and images of text. Incidental text (text that is part of a logo, purely decorative, or in an inactive UI component) is exempt. Placeholder text in input fields, however, should pass contrast requirements since it provides labelling information. Text in images (like screenshots or charts where text is not separately rendered) must also meet contrast requirements if it conveys meaning. UI components like button borders, focus indicators, and icons have a separate 3:1 requirement under WCAG 2.1 Success Criterion 1.4.11 (Non text Contrast).
Darken the text colour or lighten the background (or vice versa) until the ratio passes. The simplest approach for text on a white background is to darken the text colour, every step toward black increases contrast. For coloured backgrounds, desaturate the background or increase its lightness in HSL space. This calculator provides automatic suggestions: the Suggestions panel proposes adjusted versions of your foreground or background that achieve AA compliance while staying as close to your original colour as possible. Run the check again after any adjustment to confirm the new ratio.
WCAG 2.1 does not specify a minimum font size directly, the contrast thresholds at 4.5:1 and 3:1 implicitly address size through the large text definition. However, WCAG 1.4.4 (Resize Text) requires that text can be resized up to 200% without loss of content or functionality, which effectively prevents fixed pixel sizes that refuse to scale. Some national standards and government accessibility frameworks do add explicit minimum sizes (often 12 to 14px body text). For body copy, 16px at 1.5 line height is a broadly accepted best practice for readability independent of contrast.
Placeholder text in form fields is specifically excluded from WCAG contrast requirements in some interpretations but should still aim for at least 3:1 to be usable. Disabled UI elements (greyed out buttons or inputs) are explicitly exempt from contrast requirements in WCAG 2.1, the rationale is that they are not operable and convey their unavailability through their muted appearance. However, consider providing alternative visual cues or tooltips explaining why an element is disabled, since users with low vision may not perceive the disabled state from colour alone.
From the blog
Notes on images and colour
Format choices, compression tradeoffs and accessible palettes.