WCAG Contrast Checker
The WCAG Contrast Checker tests any foreground and background colour pair against the WCAG 2 ratios — AA and AAA for normal and large text, 3:1 for non-text UI — with a live preview at several sizes and a one-click Suggest fix that finds the nearest passing colour.
How to Use
- 1
Enter a foreground (text) colour and a background colour — hex (#1f2937), rgb(31, 41, 55), or hsl(220, 13%, 18%) — or use the colour pickers. Named colours are not parsed.
- 2
Read the exact ratio (for example 7.00:1) and the pass/fail badges for normal text, large text, and non-text UI, with the WCAG criterion numbers (1.4.3, 1.4.6, 1.4.11).
- 3
Read the live preview: the same text at several sizes and weights on your exact background — judge readability by reading it, not just by the number.
- 4
If the pair fails, click Suggest fix: the tool nudges the foreground's lightness in 1% steps until it reaches AA for normal text (4.5:1) and shows the nearest passing colour — click it to apply.
- 5
Try a real pair from the preset list — for example #767676 on white (about 4.54:1, just passes AA) or #999999 on white (fails) — to calibrate what the numbers feel like.
- 6
To check a whole palette pair by pair, generate it in the Color Palette Generator and test each combination here.
Frequently Asked Questions
What is a good contrast ratio?
What is the difference between AA and AAA?
What counts as large text?
Does contrast checking cover color blindness?
What is APCA and why isn't it here?
How does Suggest fix work?
Why does #767676 on white pass but #999999 fail?
Can I check a whole palette, not just one pair?
Does passing contrast mean my site is accessible?
Is anything uploaded?
Generative Answer & AI Documentation
What is the WCAG Contrast Checker?
The WCAG Contrast Checker takes two colours — a foreground (text) colour and a background colour — and returns their exact WCAG 2 contrast ratio, for example 4.54:1, with pass/fail badges for normal text, large text, and non-text UI, each labelled with its WCAG criterion number (1.4.3, 1.4.6, 1.4.11). Enter colours as hex (#1f2937), rgb(31, 41, 55), or hsl(220, 13%, 18%), or use the colour pickers. A live preview shows the same text at several sizes and weights on your exact background, plus a button with the colours reversed, so you can judge readability by reading rather than by the number alone. If the pair fails, Suggest fix nudges the foreground's lightness in 1% steps until it reaches AA for normal text (4.5:1) and shows the nearest passing colour — click it to apply. Any two colours can be compared, not just a colour against white or black. The ratio is pure WCAG 2 maths done in your browser; nothing is uploaded.
Why use WCAG Contrast Checker offline?
Text that is too light for its background is the most common accessibility failure on the web, and it is invisible to the person who chose the colours — light grey on white looks fine on a bright designer monitor and fails for everyone reading on a dim screen, in sunlight, or with reduced vision. The failure is also cheap to prevent: it is one number, computed from two hex codes, before anything ships. This page exists for the moment before shipping, when the question is concrete — is this grey on this white readable, and if not, what is the nearest colour that is? The Suggest fix button answers the second half, which a bare ratio never does, and the pairwise check answers the question palette pages cannot: whether two colours from the same palette actually work together, not just whether each one works against white.
When should you use this tool?
Use it before shipping any text: a button's label on its background, body text on a card, a link colour on white, a badge's text on its fill, placeholder text in an input, or an icon's colour against its surface. Use it when a design hands you a colour pair and you need a verdict with the criterion number to attach to a review. Use it after generating a palette in the Color Palette Generator — test each combination you actually use, one pair at a time. Do not use it as a whole-site accessibility certificate: contrast is one check among many, and a passing ratio says nothing about keyboard access, focus order, alt text, or heading structure.
Key Benefits
- Exact ratio to two decimals, computed from the WCAG 2 relative-luminance formula — not a rounded guess.
- Pairwise checking: any two colours against each other, the gap in palette pages that only check against white and black.
- AA and AAA badges for normal text (4.5:1 / 7:1), large text (3:1 / 4.5:1), and non-text UI (3:1), each with its WCAG criterion number.
- Suggest fix: one click finds the nearest foreground colour that reaches AA for normal text, by nudging lightness in 1% steps.
- Live preview at several sizes and weights on your exact background, plus a reversed-colour button — judge by reading, not by the number.
- Hex, rgb(), and hsl() input plus colour pickers, a swap button, and preset pairs with real ratios to calibrate against.
- Honest standard: WCAG 2 ratios only, no APCA score, and the page says so — APCA belongs to the WCAG 3 draft, not a citable standard.
- 100% private: two colours in, one number out, nothing sent anywhere.
Common Use Cases
- Checking a button before shipping: white text on an indigo #4f46e5 background is about 6.29:1 — it passes AA and AAA for large text and AA for normal text, so the label is safe at any size.
- Fixing grey body text: #767676 on white is about 4.54:1 — it just passes AA for normal text — while #999999 on white is about 2.85:1 and fails. Darken the grey to #595959 (about 7:1) for AAA.
- Checking a link colour: #2563eb on white is about 5.17:1, so it passes AA for normal text — but a lighter blue used for links on a tinted background may not, and the checker shows it in one step.
- Checking a whole palette pairwise: generate the palette in the Color Palette Generator, then test body text on background, accent on background, and button text on button colour here, one pair at a time.
- Reviewing a design handoff: paste the two hex codes from the design file and attach the ratio and criterion number (1.4.3 for AA normal text) to the review comment.
Developer Notes & Best Practices
The ratio follows the WCAG 2 definition exactly. Relative luminance L for a colour is 0.2126·R + 0.7152·G + 0.0722·B, where each channel is linearised from sRGB: a channel value c (0–255) becomes c/255, then c/12.92 if it is at most 0.03928, otherwise ((c + 0.055)/1.055)^2.4. The contrast ratio is (L1 + 0.05) / (L2 + 0.05), with L1 the lighter luminance — which is why the maximum is 21:1 (black on white) and identical colours score 1:1. Thresholds are the WCAG 2.2 values: normal text AA 4.5:1 (criterion 1.4.3), normal text AAA 7:1 (1.4.6), large text AA 3:1 (1.4.3), large text AAA 4.5:1 (1.4.6), non-text UI 3:1 (1.4.11, with no AAA level). Large text means 18pt (24px) or larger, or 14pt (about 18.66px) bold or larger. Suggest fix works in HSL: it keeps the foreground's hue and saturation and steps its lightness by 1% — darker when the foreground is darker than the background, lighter when it is lighter — until the ratio reaches 4.5:1, up to 100 steps; if even pure black or pure white in that direction cannot pass, it says so. All ratios quoted on this page were computed by the same code the tool runs: #767676 on white 4.54:1, #595959 on white 7.00:1, #999999 on white 2.85:1, and the Suggest fix for #777777 on white is #757575 (which reaches 4.5:1). There is no APCA score anywhere on this page: APCA is part of the WCAG 3 working draft, which cannot be cited as a standard.
WCAG 2.2 contrast thresholds
| What is checked | AA threshold | AAA threshold | Criterion |
|---|---|---|---|
| Normal text (under 18pt, or under 14pt bold) | 4.5:1 | 7:1 | 1.4.3 / 1.4.6 |
| Large text (18pt+, or 14pt+ bold) | 3:1 | 4.5:1 | 1.4.3 / 1.4.6 |
| Non-text UI — icons, borders, focus indicators | 3:1 | No AAA level | 1.4.11 |
Real pairs — calibrated ratios (computed by this tool)
| Foreground on background | Ratio | Normal text |
|---|---|---|
| #000000 on #ffffff | 21.00:1 | AAA |
| #595959 on #ffffff | 7.00:1 | AAA |
| #767676 on #ffffff | 4.54:1 | AA (just passes) |
| #777777 on #ffffff | 4.48:1 | Fails AA — Suggest fix gives #757575 |
| #999999 on #ffffff | 2.85:1 | Fails AA |
| #eab308 on #ffffff | 1.92:1 | Fails AA — Suggest fix gives #947005 |
| #ffffff on #4f46e5 | 6.29:1 | AA (AAA for large text) |
| #2563eb on #ffffff | 5.17:1 | AA |
The most common failing pairs — and their fixes
| Failing pair | Why it fails | Fix |
|---|---|---|
| Light grey body text on white | Grey near white has almost no lightness difference | Darken to #595959 (7:1, AAA) or at least #767676 (4.54:1, AA) |
| Light blue links on white | Blue is dark in luminance only when it is saturated and deep | Use a deeper blue such as #2563eb (5.17:1) |
| Yellow or light green on white | Yellow is the lightest hue — almost no contrast against white | Darken hard (#947005 for the yellow above) or put it on a dark background |
| White text on a light brand colour | A light background cannot carry white text | Darken the background or use dark text on it instead |
- Check the pair you actually ship, at the size you actually ship it: a grey that passes for a 24px heading can fail for the 14px paragraph underneath it, because the threshold changes with size.
- Judge by reading the live preview, not just by the badge: a ratio of 4.54:1 passes AA, but it is still light grey text — if it feels hard to read, darken it toward 7:1 anyway.
- Use Suggest fix as a starting point, not a verdict: the nearest passing colour may not be your brand colour, so take it back to the designer and pick the closest brand step that passes.
- Check every state, not just the default: hover, disabled, placeholder, and focus states each have their own colours, and placeholder text is where light grey most often ships untested.
- Check icons and borders too: a 3:1 ratio is required for non-text UI (criterion 1.4.11), so a faint border or a pale icon can fail even when the text next to it passes.
- Never rely on colour alone: a pair can pass contrast and still be indistinguishable to a colour-blind user if the colours differ only in hue — pair colour with a label or an icon.
Common Mistakes
- Checking a colour against white when the text actually sits on a tinted card: the background that matters is the one behind the text, not the page background — paste that colour in.
- Assuming a large-text pass covers body text: large text needs only 3:1, normal text needs 4.5:1 — the same grey can pass as a heading and fail as a paragraph.
- Treating 4.54:1 as comfortably passing: #767676 on white passes AA by 0.04 — one step lighter and it fails, so prefer a margin (aim for 7:1 on body text where you can).
- Forgetting placeholder and disabled text: placeholder text is real text users must read, and it is usually the lightest grey on the page — check it as normal text.
- Using a ratio from a different method: APCA scores and WCAG ratios are different numbers on different scales — do not compare an APCA score against 4.5:1.
- Claiming a site is accessible because its text passes: contrast is one check. Keyboard access, focus visibility, alt text, and labels are separate, and none of them is covered here.
Limitations
This page checks WCAG 2 contrast ratios only — it does not compute an APCA score (APCA is part of the WCAG 3 working draft, not a citable standard), and it does not simulate colour blindness. A passing ratio does not certify a site as accessible: keyboard access, focus order and visibility, alt text, heading structure, form labels, and motion sensitivity are separate checks, and a site can pass every contrast check and still be unusable with a keyboard or a screen reader. Suggest fix only changes lightness — it never changes hue — so it can fail when the background itself sits in the middle of the lightness range, in which case no lightness of that hue can reach 4.5:1 and either the hue or the background must change. Named CSS colours are not parsed: enter hex, rgb(), or hsl(). The preview shows the pair on a plain background; it cannot reproduce the effect of a photograph, a gradient, or a translucent overlay behind the text — for text over images, test the darkest part of the image, not the average.
Structured Input/Output Example
Foreground #767676, background #ffffff
Contrast ratio: 4.54:1 Normal text AA (1.4.3, 4.5:1): Pass Normal text AAA (1.4.6, 7:1): Fail Large text AA (1.4.3, 3:1): Pass Non-text UI (1.4.11, 3:1): Pass
Related Tools
Color Palette Generator
Color palette generator: one base color in — a 5-color harmony palette plus a 50–950 Tailwind scale. Lock, shuffle, copy HEX/RGB/HSL, export CSS or JSON.
Color Converter
Color converter: translate colors between HEX, RGB, HSL and OKLCH with a live preview swatch. Type a hex code or pick visually, then copy clean CSS.
CSS Gradient Generator
CSS gradient generator with linear, radial, conic and mesh/aurora gradients — live preview, presets, Tailwind output and PNG export. 100% offline.
HEX to RGB Converter
Hex to RGB converter: turn any hex color code into red, green, and blue channel values. Handles 3-digit, 6-digit, and 8-digit hex with alpha.