WCAG color contrast checker

Paste a text color and a background color — hex, rgb(), hsl() or a CSS color name — and read the contrast ratio against the five WCAG 2 checks: AA and AAA for normal text, AA and AAA for large text, and the 3:1 line for UI components. See the pair on sample text and a button, swap them, and when a check fails, take the nearest color that passes. No account needed.

Read as a hex code — #4f46e5.

Read as a hex code — #ffffff.

Contrast ratio

6.29:1

Passes WCAG AA for normal text, AAA for large text

  • AA normal text4.5:1pass
  • AAA normal text7:1fail
  • AA large text3:1pass
  • AAA large text4.5:1pass
  • AA UI components3:1pass

Large text is 24px (18pt) regular or 18.66px (14pt) bold. The UI-component check is WCAG 1.4.11 — borders, icons and focus rings against what they sit on; it has no AAA level.

Normal text at 16px. The quick brown fox jumps over the lazy dog, and the contrast between these two colors decides whether you can read it.

Large text at 24px regular

Large text at 18.66px bold

Outline buttonFilled button

Nearest passing colors — hue and saturation kept, only lightness moves

  • Text darker for AAA (7:1)#4239e37.18:1

CSS custom properties with the measured verdict — paste into your globals.css.

/* Contrast 6.29:1 — AA normal text: pass · AAA normal text: fail · AA large text: pass · AAA large text: pass · AA UI components: pass */
:root {
  --color-foreground: #4f46e5;
  --color-background: #ffffff;
}

/* Generated with Nodlume — https://nodlume.dev/contrast-checker */

Five checks, one ratio

The ratio is computed once, from WCAG 2's relative-luminance formula, and judged against every threshold the spec sets — 4.5:1 and 7:1 for text, 3:1 for large text and for the borders, icons and focus rings that 1.4.11 covers. WCAG 2.x only; the draft APCA model is not computed here.

The nearest fix, not any fix

When a level fails, the tool walks the color's lightness one point at a time in both directions and offers the first shade that passes, for the text and for the background separately. Hue and saturation never move, every suggestion is re-measured before it is shown, and when nothing reaches the target it says so instead of guessing.

Same math as the workspace

The luminance function behind this page is the one the theme generator uses to repair its derived dark mode and the one every CSS color reference page reports, so a pair that passes here passes there.

WCAG contrast, answered

What contrast ratio does WCAG AA require?
4.5:1 for normal text and 3:1 for large text (WCAG 2 success criterion 1.4.3). AAA raises those to 7:1 and 4.5:1 (1.4.6). The ratio runs from 1:1, two identical colors, to 21:1, black on white, and is computed from each color's relative luminance — not from how different the hues look.
What counts as large text?
Text at 18 point or larger, or 14 point or larger if it is bold. In CSS pixels at the usual 96 dpi that is 24px regular or about 18.66px bold. The sample block on this page renders exactly those two sizes beside 16px body text so you can see what the large-text allowance actually covers.
What is the difference between AA and AAA?
AA is the level most laws, procurement rules and audits cite, and the one to design to by default. AAA is stricter — 7:1 for normal text — and WCAG itself says it is not achievable for all content. Treat AAA as the target for long reading passages and anything aimed at readers with low vision, and AA as the floor for everything.
Does contrast apply to icons, borders and buttons?
Yes, at 3:1 (success criterion 1.4.11, Non-text Contrast). It covers the parts of a control a person needs to identify it and its state — an input's border, a checkbox outline, a focus ring — and the parts of an icon or chart needed to understand it. Text inside a button follows the text rules instead. There is no AAA level for non-text contrast, and decorative or disabled elements are exempt.
Why do two mid-greys fail even though they look different?
Because the ratio is (lighter luminance + 0.05) divided by (darker luminance + 0.05), and two mid-tones have similar luminance however distinct their hues. Even #808080 on pure white only reaches 3.95:1, short of AA for body text. Contrast comes from a lightness gap, which is why the fixes on this page move only lightness and keep the hue you chose.
Is black on white really 21:1?
Yes. White has a relative luminance of 1 and black 0, so the formula gives (1 + 0.05) / (0 + 0.05) = 21. It is the highest ratio possible; nothing reaches 22. In practice most interfaces use a near-black on an off-white, which still lands comfortably above 15:1.
Does this tool send my colors anywhere?
No. The page runs entirely in your browser, needs no account, and stores nothing — reload and it starts from the default pair again. The only time your colors leave the page is when you copy the share link, which puts them in the URL for you.

Two colors that pass are the start of a palette

An interface needs more than a text color and a background. The palette generator grows the full eight-role set from one seed, the color converter turns any notation into the hex this page measures, and the dark mode converter derives a dark side that is checked against these same thresholds before you ship it. In the Nodlume workspace the theme you settle on becomes the stylesheet of a generated Next.js project.

We'd like to use Google and Microsoft Clarity cookies to understand how Nodlume is used (including masked session replays) and to measure our advertising. Optional cookies only load if you accept, and declining does not affect anything in the app.