AnyTool
Your files never leave your device. All processing happens locally in your browser.

How do I check colour contrast for WCAG accessibility?

Enter a text (foreground) colour and a background colour and the tool computes the WCAG 2.x contrast ratio and tells you instantly whether the pair passes AA and AAA for normal and large text — all in your browser. AA needs 4.5:1 for normal text and 3:1 for large text or UI components; AAA needs 7:1 and 4.5:1.

  • Contrast ratio = (L1 + 0.05) / (L2 + 0.05) using WCAG relative luminance, range 1:1 to 21:1
  • AA: 4.5:1 normal text, 3:1 large text (≥24px, or ≥18.66px bold) and non-text UI
  • AAA: 7:1 normal text, 4.5:1 large text
  • Live text + button preview, colour-blindness simulation, and one-tap darker/lighter fixes
  • 100% client-side — colours are just numbers that never leave your browser

What is

Colour Contrast Ratio (WCAG)

The colour contrast ratio is a number from 1:1 to 21:1 that quantifies the luminance difference between two colours, computed as (L1 + 0.05) / (L2 + 0.05) where L1 and L2 are the WCAG relative luminances of the lighter and darker colour. Relative luminance is found by gamma-decoding each sRGB channel to linear light and weighting them 0.2126·R + 0.7152·G + 0.0722·B. WCAG 2.2 requires at least 4.5:1 for normal body text (Level AA), 3:1 for large text and user-interface components, and 7:1 for the enhanced Level AAA.

Web Accessibility

Related terms

WCAG 2.2relative luminanceAA / AAASC 1.4.3SC 1.4.11APCAcolour-vision deficiency

Frequently Asked Questions

Yes. Your two colours are parsed and the contrast ratio and pass/fail are computed entirely on your device — nothing is uploaded, and there is no server or CDN in the processing path.

Everything is 100% client-side. The tool holds your foreground and background as plain colour values, computes the WCAG relative luminance and contrast ratio, evaluates every AA / AAA and UI-component threshold, and even simulates colour-blindness right in your browser tab — no input is ever sent to a server, and there is no CDN in the processing path. It works offline once the page is cached, and closing the tab discards everything.

Level AA needs 4.5:1 for normal text and 3:1 for large text and UI components; Level AAA needs 7:1 for normal text and 4.5:1 for large text.

WCAG 2.2 sets two conformance levels. For Level AA (the benchmark referenced by the ADA and the EU’s EN 301 549), body text needs a contrast ratio of at least 4.5:1, while large text — 24px or larger, or 18.66px (14pt) and bold — needs 3:1, and the same 3:1 applies to non-text user-interface components and meaningful graphics (SC 1.4.11). Level AAA is stricter: 7:1 for normal text and 4.5:1 for large text. This tool shows all of these thresholds as PASS/FAIL live as you type.

No. WCAG 2.x is a mathematical floor, not a promise of readability — some passing pairs still feel hard to read, which is why WCAG 3 is moving to the APCA algorithm.

A passing WCAG 2 ratio is a minimum, not a guarantee. The WCAG 2 formula is known to be imperfect: thin light-on-dark text can pass yet feel hard to read, and some pairs that technically fail look fine, because the formula ignores font weight, size, polarity and the surrounding brightness. That is exactly why WCAG 3 is developing APCA (Advanced Perceptual Contrast Algorithm). For compliance today you must still meet WCAG 2 AA; treat it as the floor and verify real readability with users, especially in dark mode.

The ratio ignores alpha — flatten a semi-transparent colour over its real backdrop first. The colour-blindness views are matrix approximations, not a medical assessment.

WCAG contrast is defined between two solid colours, so the ratio here ignores any alpha/opacity — if your text or background is semi-transparent, flatten it over the colour actually behind it and check that result. The colour-vision simulations (protanopia, deuteranopia, tritanopia and achromatopsia) use published Viénot and Brettel transform matrices applied in linear light; they illustrate how a pair may collapse for the roughly 1 in 12 men with a colour-vision deficiency, but on an uncalibrated sRGB screen they are approximations of perception, not a per-individual or medical diagnosis.

Detailed Explanation

Methodology

How the Color Contrast Checker Measures Contrast

The tool implements the WCAG 2.x contrast algorithm exactly. Each colour is parsed (from hex, rgb(), hsl(), oklch() or a CSS name) and each sRGB channel is gamma-decoded to linear light — c ≤ 0.04045 → c/12.92, otherwise ((c+0.055)/1.055)^2.4 — then combined into a relative luminance L = 0.2126·R + 0.7152·G + 0.0722·B. The contrast ratio is (L_light + 0.05) / (L_dark + 0.05), which ranges from 1:1 for identical colours to 21:1 for pure black on pure white. All of this runs in a pure engine (contrastCheckerEngine.ts) in the browser, updating live as the colours change.

  • Relative luminance L = 0.2126·R + 0.7152·G + 0.0722·B on gamma-decoded linear channels
  • Contrast ratio = (L_light + 0.05) / (L_dark + 0.05), range 1:1 to 21:1
  • Accepts hex, rgb(), hsl(), oklch() and CSS colour names via culori
  • Pure and deterministic — the same two colours always give the same ratio
Technical Details

WCAG 2.2 AA and AAA Thresholds

WCAG 2.2 defines two conformance levels for contrast. Level AA (Success Criterion 1.4.3) requires at least 4.5:1 for normal text and 3:1 for large text — text 24px or larger, or 18.66px (14pt) and bold. The same 3:1 minimum applies to non-text user-interface components and meaningful graphics under SC 1.4.11. Level AAA (SC 1.4.6) is stricter, requiring 7:1 for normal text and 4.5:1 for large text. The tool renders each of these as an explicit PASS/FAIL row so the exact conformance level is unambiguous.

  • AA normal text: 4.5:1 (SC 1.4.3)
  • AA large text and non-text UI: 3:1 (SC 1.4.3 / SC 1.4.11)
  • AAA normal text: 7:1, AAA large text: 4.5:1 (SC 1.4.6)
  • Large text = ≥24px regular or ≥18.66px (14pt) bold
  • AA is the level referenced by the ADA and the EU EN 301 549 standard
Use Cases

Colour-Vision-Deficiency Simulation

To help catch pairs that separate for typical vision but collapse for colour-blind users, the tool re-renders the live text/button specimen under four colour-vision deficiencies: protanopia, deuteranopia, tritanopia and achromatopsia. Simulation is done in linear-light sRGB (gamma-decode → 3×3 matrix → gamma-encode) using the Viénot–Brettel–Mollon 1999 matrices for protan and deutan and a Brettel-style matrix for tritan; achromatopsia is a Rec.709 luma collapse. The measured contrast ratio and pass/fail always use the real, unmodified colours — only the preview changes.

  • Protan/deutan use the Viénot–Brettel–Mollon 1999 single-matrix model
  • Simulation is applied in linear light, not gamma-encoded sRGB
  • Red-green deficiency affects roughly 1 in 12 men and 1 in 200 women
  • The contrast ratio and verdict use the real colours, not the simulated ones
Limitations

Honest Limitations: A Floor, Not a Guarantee

WCAG 2.x contrast is a mathematical floor, not a promise of readability. The formula is known to be imperfect: thin light-on-dark text can pass yet feel hard to read, and some pairs that technically fail look fine, because it ignores font weight, size, polarity and surrounding brightness — the reason WCAG 3 is developing the APCA algorithm. The ratio is defined between two solid colours and therefore ignores alpha/opacity, so a semi-transparent colour must be flattened over its real backdrop before checking. The colour-blindness views are matrix approximations on an uncalibrated sRGB screen, not a per-individual or medical assessment.

  • A passing WCAG 2 ratio is a minimum, not a readability guarantee
  • The formula ignores font weight, size and polarity; WCAG 3 moves to APCA
  • Alpha/opacity is ignored — flatten transparent colours over their real backdrop first
  • Contrast is one of many WCAG criteria; do not rely on colour alone to convey meaning
  • CVD simulation is an approximation of perception, not a medical diagnosis
Privacy & Security

Private by Design

Everything happens on the user’s device. The two colours are parsed and the relative luminance, contrast ratio, AA/AAA verdicts, colour-blindness simulations and accessible-colour suggestions are all computed locally in the browser tab — there is no server call and no CDN in the processing path. The colours are just numbers; nothing is uploaded, logged or stored, and the tool works offline once loaded.

  • Colours are parsed and all contrast math runs entirely in the browser
  • No upload, no CDN in the processing path, no server, no tracking
  • Output is copyable text (hex / rgb / hsl / ratio) written locally to the clipboard
  • Works offline after first load; nothing is stored server-side
WCAG 2.x contrast requirements by conformance level and text size
ContentAA minimumAAA minimumSuccess criterion
Normal text (< 24px, or < 18.66px bold)4.5:17:1SC 1.4.3 / 1.4.6
Large text (≥ 24px, or ≥ 18.66px bold)3:14.5:1SC 1.4.3 / 1.4.6
Non-text UI components & graphics3:1(n/a — no AAA rule)SC 1.4.11
Incidental / disabled / logo textexemptexemptSC 1.4.3

WCAG 2.2, Level AA is the benchmark referenced by the ADA and the EU EN 301 549 standard. A passing ratio is a floor, not a guarantee of readability — WCAG 3 is developing the perceptual APCA algorithm. As of July 2026.