Contrast Checker

Check text color contrast against WCAG AA/AAA standards. Enter foreground and background colors to get the ratio instantly.

Ad space — add Google AdSense after the site has useful content and is ready for review.
Your result will appear here.

Contrast Checker online

Check whether a text/background color pair meets WCAG contrast requirements — the ratio computed from relative luminance, with AA and AAA verdicts for normal and large text.

How it works

The tool computes the relative luminance of each color using the sRGB formula with gamma correction, then calculates the contrast ratio:

L = 0.2126 × R + 0.7152 × G + 0.0722 × B (after gamma expansion)

Contrast = (L_lighter + 0.05) / (L_darker + 0.05)

The ratio is compared against WCAG 2.1 thresholds:

  • AA normal text: ≥ 4.5:1
  • AA large text (18pt+ / 14pt bold): ≥ 3:1
  • AAA normal text: ≥ 7:1
  • AAA large text: ≥ 4.5:1

A live text preview shows your chosen colors at both normal and large sizes.

Worked example

Foreground #1A1A1A (near-black) on background #FFFFFF (white): L₁ ≈ 0.0103, L₂ = 1.0 → ratio = (1.0 + 0.05) / (0.0103 + 0.05) ≈ 17.4:1. Passes AAA for both normal and large text.
Foreground #767676 (medium gray) on #FFFFFF: ratio ≈ 4.54:1 — just passes AA for normal text, fails AAA.

Practical tips

  • Aim for at least AA (4.5:1 normal / 3:1 large) for all body text.
  • Use the large text threshold (3:1) for headings ≥ 18 pt or bold ≥ 14 pt.
  • Slight adjustments to hue/saturation often fix a failing ratio without changing the design intent.
  • Test both light-on-dark and dark-on-light — symmetry is not guaranteed.

Edge cases and limitations

  • The ratio is not the readability. WCAG's formula weighs luminance only; a saturated blue on black can pass 4.5:1 and still shimmer for many readers. Treat a pass as the legal floor, then look at the pair with your own eyes at real size — thin font weights need more margin than the ratio suggests.
  • Text over images has no single ratio. Over a photo or gradient, contrast varies pixel by pixel; check the text against the lightest (for dark text) or darkest (for light text) part of the image behind it, and add a shadow or overlay scrim when the worst case fails.
  • Hover, focus and disabled states count too. The pair you check is usually the resting state. Placeholder text, disabled buttons and link hover colors are the states real pages most often fail with — they are exempt in some WCAG readings (disabled controls), but placeholders are not.
  • Anti-aliasing cheats small text. Rendered glyphs blend edge pixels with the background, so 12 px text effectively shows a weaker ratio than the formula's solid-color assumption. Passing at 4.6:1 in the tool can look like a fail on screen; keep a buffer for small sizes.

Privacy and browser processing

The calculation runs entirely in your browser — the colors you enter are never uploaded.

Frequently asked questions

What is the difference between AA and AAA?

AA is the minimum legal requirement in many jurisdictions; AAA is the enhanced (stricter) level for optimal accessibility. AA requires 4.5:1 for normal text; AAA requires 7:1.

What counts as "large text"?

Text ≥ 18 pt (24 px) or bold text ≥ 14 pt (18.5 px). Large text has a lower threshold (3:1 for AA, 4.5:1 for AAA).

Why do I need gamma correction?

sRGB colors are gamma-encoded. Luminance must be calculated in linear space — the tool expands each channel (c/255) with the standard sRGB inverse gamma (c ≤ 0.04045 ? c/12.92 : ((c+0.055)/1.055)^2.4) before applying the luminance weights.

Can I use this for non-text elements (icons, borders)?

WCAG also defines non-text contrast (3:1 for UI components and graphical objects). The same ratio applies — just test your icon color against its background.

Related tools

Ad space