Skip to tool
ecech.
🎨 Design & Color

WCAG Contrast Ratio Checker for AA and AAA

Test any foreground and background pair against every WCAG threshold at once, with a live preview and a one-click suggestion for the nearest passing colour.

Large heading text, 24px bold

Body copy at the size most interfaces actually use. If this is comfortable to read at arm's length in daylight, the ratio is doing its job.

Small print, captions and helper text — the first thing to fail.

Contrast ratio

Advertisement

How the calculation works

The formula ratio = (L₁ + 0.05) ÷ (L₂ + 0.05) L₁ = relative luminance of the lighter colour, L₂ of the darker. Luminance is gamma-corrected and weights green far more than blue. Where the thresholds sit 3:1 large text AA 4.5:1 body AA 7:1 body AAA 21:1 black on white

How to Use This Tool

Contrast is the accessibility requirement that fails most often and costs least to fix. It is also the one designers most frequently get wrong by intuition, because a colour pair can look elegant on a calibrated monitor in a dim studio and be genuinely unreadable on a phone in daylight, or to any of the roughly one in twelve men with a colour vision deficiency.

Entering colours

Type a hex value into either field or use the swatch to open your system colour picker. Both 6-digit and 3-digit shorthand are accepted, with or without the leading hash. Eight-digit hex with an alpha channel is accepted too, but be aware that the ratio is calculated on the resulting composite — transparency is only meaningful once you know what is behind it, so the tool composites the foreground over the background before measuring.

Reading the four results

WCAG defines separate thresholds because larger text is easier to read at lower contrast. The four panels report all of them at once:

  • AA normal text, 4.5:1 — the one that matters. This applies to body copy, labels, links and anything below 18.66px bold or 24px regular. Most legal accessibility requirements around the world reference this level.
  • AA large text, 3:1 — applies to text at 24px regular or 18.66px bold and above. Do not use this as an excuse to make body copy technically "large"; the exemption exists for headings.
  • AAA normal text, 7:1 — a stricter target. Worth hitting for long-form reading, documentation and anything a user will look at for extended periods.
  • Non-text, 3:1 — applies to interface components: input borders, icons, focus rings, chart elements. This is the most commonly missed requirement in modern design systems, because fashionable interfaces love a very light grey border.

Fixing a failure quickly

The nearest passing foreground button walks the foreground colour's lightness up or down in small steps, holding its hue and saturation, until it clears 4.5:1. That preserves the character of the colour rather than replacing it with a generic dark grey, which is what usually happens when a failure is fixed by hand under deadline. If your brand colour cannot pass on white, the honest answers are to darken the brand colour for text use specifically, or to put the brand colour on a background rather than in the text.

What contrast ratio does not tell you

The WCAG 2.x formula is a good approximation, not a perfect model of human vision. It systematically overrates light-on-dark combinations and underrates some mid-tone pairs, which is why a newer perceptual algorithm called APCA is under development for WCAG 3. Until that is normative, 4.5:1 remains the number you are measured against. Treat a marginal pass at 4.6:1 as a warning rather than a win, and check your design on an actual phone outdoors.

Advertisement

Frequently Asked Questions

What contrast ratio do I actually need?
4.5:1 for normal body text and 3:1 for large text, to meet WCAG 2.2 level AA. That is the level referenced by most accessibility legislation, including the European Accessibility Act and Section 508 in the United States. AAA raises the body requirement to 7:1, which is a good target for documentation and long-form reading.
What counts as large text?
24 pixels or larger at normal weight, or 18.66 pixels or larger at bold. Below those sizes the 4.5:1 requirement applies. The exemption exists because larger letterforms have thicker strokes and remain legible at lower contrast; it is not an invitation to declare your body copy large.
Does the 3:1 non-text requirement apply to my borders?
If the border is what tells a user that a control exists or where its boundary is, yes. Input field outlines, focus indicators, toggle switches, icon buttons and meaningful chart elements all fall under it. Purely decorative dividers and disabled controls are exempt, which is a narrower exemption than most teams assume.
Why does my white text on a colour pass but the reverse fail?
It does not, mathematically. Contrast ratio is symmetric, so swapping foreground and background gives an identical number. What changes is perception: light text on a dark background appears bolder due to halation, and the WCAG 2.x formula does not model that. If your two results differ, one of the colours changed.
What is APCA and should I use it instead?
APCA is a perceptually based contrast algorithm developed for the draft WCAG 3 specification. It models real reading conditions more accurately, particularly for dark mode and thin fonts. It is not yet normative, so conformance is still judged against the 2.x ratios. Using APCA as an additional design check is sensible; using it as your only check is not yet defensible.
How does the nearest passing colour suggestion work?
It converts your foreground to HSL, holds hue and saturation constant, and steps lightness toward whichever direction increases contrast until the pair clears 4.5:1. Keeping hue and saturation means the suggested colour still reads as the same colour family rather than collapsing to grey.
Does this handle transparency?
Eight-digit hex with an alpha channel is accepted, and the foreground is composited over the background before the ratio is measured. That is the correct approach, because a semi-transparent colour has no fixed contrast until you know what sits behind it.
Is dark mode automatically more accessible?
No. Dark mode changes which pairs pass and which fail, and it introduces its own problem: pure white on pure black at 21:1 causes halation that makes thin text harder to read for many people, including those with astigmatism. Test both themes, and consider softening pure black backgrounds to a very dark grey.

Related tools in Design & Color

Browse all Design & Color tools