Color Contrast Checker | WCAG AA & AAA Contrast Ratio Tester

🎨 Image & Design Free Forever

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.

Foreground (Text) Color
Background Color

Normal text (16px) — The quick brown fox jumps over the lazy dog.

Large text (24px bold) — Sample heading

Enter two colors and click Check Contrast to see WCAG results.
About This Tool

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

1:1identical, invisible
3:1AA large text, UI parts
4.5:1AA normal text
7:1AAA normal text
21:1black on white

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.

Passes AAA#111827 on #ffffff · 16.9:1
Fails AA#9ca3af on #ffffff · 2.5:1
Passes AA#ffffff on #1e40af · 8.6:1
Fails badly#ffffff on #fde047 · 1.4:1

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

ParseHex strings, including shorthand three character forms like #fff, are normalised and split into red, green and blue channels from 0 to 255.
LineariseEach channel converts from gamma encoded sRGB to linear light. At or below 0.04045 on a 0 to 1 scale, divide by 12.92. Above it, apply the power curve. This step exists because stored pixel values are not proportional to emitted light.
Weight and sumLinear channels combine with fixed weights: 0.2126 red, 0.7152 green, 0.0722 blue. Green dominates because human cone sensitivity peaks there. The result is relative luminance, 0 for black and 1 for white.
RatioDivide lighter by darker after adding 0.05 to each. The offset prevents division by zero on pure black and keeps the formula stable at the extremes.
// this is the entire check function toLinear(c) { c /= 255; return c <= 0.04045 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4); } function luminance(rgb) { return 0.2126*toLinear(rgb.r) + 0.7152*toLinear(rgb.g) + 0.0722*toLinear(rgb.b); } function contrastRatio(l1, l2) { var hi = Math.max(l1, l2), lo = Math.min(l1, l2); return (hi + 0.05) / (lo + 0.05); }

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

LevelApplies toMinimum
AANormal body text4.5:1
AALarge text, 18pt or 14pt bold and above3:1
AAIcons, borders, form field outlines, focus rings3:1
AAANormal body text7:1
AAALarge text4.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.

Contrast ratio knows nothing about hue. Two colours can clear 4.5:1 on luminance and remain genuinely hard to distinguish for someone with red green colour vision deficiency, which affects roughly one in twelve men. The formula measures brightness separation only. Passing WCAG contrast is necessary for accessible colour, not sufficient. Pair it with a colour blindness simulator, and never rely on colour alone to carry meaning.

How the fix suggestions are generated

When a pair fails, the tool proposes two routes rather than one, because they suit different situations.

SuggestionMethodWhen to use it
Nudge by 40Push the lighter colour further from the darker by 40 per RGB channel, recompute, and only offer it if the ratio actually improvedKeeping brand colour recognisable
Black or whiteCompute against pure black and pure white textFastest 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

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.

Common Questions

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.

Privacy Overview

Cookies let this site remember your preferences and show us which tools people actually use. Full detail sits in our Privacy Policy.