Color Contrast Checker

WCAG contrast ratio, AA/AAA verdicts, APCA and a passing color suggestion.

Runs in your browser Instant No sign-up
Text color, then background

Paste, type or drop a file — output appears as you type.

Waiting for input
Processed locally · nothing is uploadedProcessed locally

How to use it

Enter two colors, one per line: the text (foreground) color first, then the background. Any format the color converter understands works: #767676, rgb(59 130 246), hsl(220 10% 60%), oklch(0.6 0.2 260) or a CSS name like white. A single line like #333 on #fff or #333, #fff works too.

The Preview tab shows sample text in your colors at 12px, 16px, 18.66px bold, 24px and 32px bold, plus a button outline and an icon. Whenever the pair fails AA, it also shows the two suggested fixes.

Example

The default sample, mid-grey #7a7a7a on white, just misses AA:

Foreground   #7a7a7a
Background   #ffffff

Contrast ratio   4.29:1   (WCAG 2.x)

                        AA                AAA
Normal text             ✗ fail (4.5:1)    ✗ fail (7:1)
Large text              ✓ pass (3:1)      ✗ fail (4.5:1)
UI components           ✓ pass (3:1)      —

Large text = at least 24px (18pt) regular or 18.66px (14pt) bold.

APCA (WCAG 3 draft)   Lc 69.7   dark text on light · content text that isn’t body copy (about 24px / 400 or 16px / 700)

Nearest colors that pass AA for normal text (4.5:1):
  Text color   #767676   4.54:1   (HSL lightness 48% → 46%)
  Background   #0d0d0d   4.52:1   (HSL lightness 100% → 5%)

The status bar sums it up as 4.29:1 · AA large text only. #767676 is the lightest grey that passes on white, which is why it shows up in so many design systems.

How the numbers are computed

WCAG 2.x ratio. Each color’s relative luminance is computed by linearising the sRGB channels and weighting them 0.2126 R + 0.7152 G + 0.0722 B. The ratio is (L1 + 0.05) / (L2 + 0.05), with the lighter color as L1, so it runs from 1:1 (identical colors) to 21:1 (black on white).

APCA Lc. This is the 0.0.98G-4g formula from the APCA-W3 reference code. It uses separate exponents for text and background, soft-clamps near-black colors and clips very low contrast to 0. Black on white is Lc 106.0 and white on black is Lc -107.9. The tool shows what the value is enough for:

  • 75 or more: body text
  • 60: other content text
  • 45: headlines
  • 30: placeholder or disabled text
  • 15: non-text elements

Common mistakes

  • Brand-colored buttons with white text. White on #3b82f6 (Tailwind blue-500) is 3.67:1. That passes for large text but not for a 14px button label. The tool suggests darkening the background along the same hue.
  • Measuring only the text. Input borders, focus indicators and icons that carry meaning need 3:1 against their surroundings (WCAG 1.4.11).
  • Placeholder text. It’s still text: if it carries information, it needs 4.5:1.
  • Opacity instead of a color. opacity: .6 on text over a photo or gradient has no single contrast value. Test the worst spot, or add a solid backdrop.

If you’re designing social images, check the text and background colors here before using them in the OG image generator. Dark-on-light pairs also matter for the QR code generator, because scanners need a dark code on a light background.

Frequently asked questions

What contrast ratio do I need?

For WCAG 2.2 level AA: 4.5:1 for normal text, 3:1 for large text (at least 24px regular or 18.66px bold), and 3:1 for UI components and meaningful graphics such as input borders, focus rings and icons. Level AAA raises text to 7:1 (normal) and 4.5:1 (large). AA is what most laws and policies require, including the EU's EN 301 549 and the US Section 508.

Is 4.49:1 close enough to pass?

No. WCAG thresholds are exact, and the ratio is not rounded before comparing. That's why the tool truncates the displayed ratio: 4.499 shows as 4.49:1 and fails, instead of rounding up to 4.50:1 and looking like a pass.

What is APCA and should I use it?

APCA (Accessible Perceptual Contrast Algorithm) is the contrast method proposed for the WCAG 3 draft. It accounts for polarity: light text on dark reads differently from dark text on light, so the Lc value is negative for light-on-dark. It matches perception better than the WCAG 2 ratio, especially for dark themes, but it isn't a legal requirement yet. Use it as a second opinion and meet WCAG 2.x AA for compliance.

How is the suggested color chosen?

The tool keeps the hue and saturation and changes only the HSL lightness. It searches both darker and lighter shades for the smallest change that reaches 4.5:1, checking the rounded hex value. It suggests both a new text color and a new background, so you can keep a brand color on whichever side matters.

Does it handle transparent colors?

Yes. A translucent text color is blended over the background before measuring, as WCAG specifies, and the blended color is reported. A translucent background is blended over white, with a warning, because the tool can't know what is behind it. Paste the opaque color underneath for an exact result.

Last updated