The Most Useful Site in the World ← Back to the tools
Algorithms & Computer Science · Free tool

WCAG Contrast Checker

Check whether two colours meet the WCAG 2.1 contrast requirements — foreground text on background, for normal text, large text and UI components. Enter hex codes or pick colours; the ratio and pass/fail results update live.

Last updated: · By Russell Head

⚡ The short version

Enter a foreground and background colour. The tool calculates the WCAG 2.1 contrast ratio and tells you whether the combination passes AA (4.5:1 for normal text, 3:1 for large text) and AAA (7:1 and 4.5:1 respectively). Black on white is 21:1 — the maximum. White on white is 1:1 — invisible.

The calculator

Runs entirely in your browser — nothing you type leaves your device. Open the standalone tool.

How to use it

  1. Foreground colour — the text or icon colour. Enter a hex code (#ffffff) or use the colour picker.
  2. Background colour — what the text sits on. If the background is an image or gradient, sample the lightest or darkest area that text crosses.
  3. Read the ratio and the compliance badges. AA is the legal minimum in most accessibility regulations; AAA is the higher standard. Normal text needs 4.5:1 (AA) or 7:1 (AAA); text at 18pt or 14pt bold and above needs 3:1 (AA) or 4.5:1 (AAA).
  4. Check UI components too. WCAG 2.1 requires 3:1 for graphical objects and UI components (icons, form borders, focus indicators) — the tool reports this as well.

Worked example

Foreground: #1a1a2e (dark navy). Background: #f5f5f5 (off-white). The tool computes the relative luminance of each colour using the WCAG formula: L = 0.2126×R + 0.7152×G + 0.0722×B (after linearising the sRGB values).

The lighter colour's luminance plus 0.05, divided by the darker colour's luminance plus 0.05, gives the ratio. For #1a1a2e on #f5f5f5 the ratio is approximately 15.1:1 — a comfortable pass at every WCAG level: AAA for normal text (needs 7:1), AAA for large text (needs 4.5:1), and well above the 3:1 threshold for UI components.

Now try #777777 on #ffffff: the ratio is about 4.48:1 — a narrow fail for AA normal text (needs 4.5:1) but a pass for large text and UI components. This is the kind of near-miss that catches designers in audits.

A tool for checking contrast, not a full accessibility audit. Colour contrast is one of the most common WCAG failures, but accessibility is much wider: keyboard navigation, screen reader semantics, focus management, motion sensitivity and content structure all matter. This tool checks one criterion (WCAG 2.1 Success Criterion 1.4.3 and 1.4.11) thoroughly.

What contrast ratio alone cannot tell you

❓ Frequently asked questions

What is the WCAG contrast ratio?

The contrast ratio measures the difference in perceived brightness between two colours, ranging from 1:1 (identical) to 21:1 (black on white). The WCAG 2.1 guidelines require 4.5:1 for normal-sized text (AA), 3:1 for large text (AA), 7:1 for normal text (AAA) and 4.5:1 for large text (AAA).

What counts as large text for WCAG?

Text that is at least 18pt (24px) or at least 14pt (18.66px) bold. Large text has a lower contrast requirement (3:1 for AA instead of 4.5:1) because larger characters are easier to read at lower contrast. Body text at 16px is normal text, not large.

Do I need to meet AAA or is AA enough?

AA is the minimum required by most accessibility laws (the Equality Act in the UK, the ADA in the US, the European Accessibility Act). AAA is the enhanced standard and is recommended where practical, but the guidelines do not require AAA for all content — it is aspirational for many organisations.

How is the contrast ratio calculated?

The WCAG formula converts each colour's sRGB values to linear light, computes a relative luminance (L = 0.2126R + 0.7152G + 0.0722B), then divides the lighter luminance plus 0.05 by the darker luminance plus 0.05. The result is a ratio from 1:1 to 21:1.