Color contrast checker

Enter a text color and a background color to get the WCAG 2.2 contrast ratio, pass or fail at every level, a live preview, and the nearest colors that pass.

Contrast ratio
–

Shown to two decimals and never rounded up: 4.499:1 reads 4.49 and fails 4.5:1.

WCAG 2.2 levelNeedsResult

Preview

Normal text at 16px. The quick brown fox jumps over the lazy dog.

Large text at 24px

Bold large text at 18.67px

ButtonInput border

The button is filled with the text color and the input border is drawn in it, both on the background, to show the 3:1 check for UI components.

How to use the color contrast checker

  1. Type the Text color in any CSS format, such as #ffffff, rgb(255 255 255) or white, or click the swatch to use your system color picker.
  2. Set the Background color the same way. Use Swap colors to check the pair the other way round.
  3. Read the Contrast ratio and the pass or fail result for AA and AAA text and for UI components.
  4. Check the Preview at normal, large and bold sizes, and the button and input border samples.
  5. If a level fails, click a Suggested fix to apply the nearest text or background color that passes.
  6. Use Copy link to share the exact pair: both colors are saved in the page address.

What the checker tests

WCAG 2.2 has three main contrast success criteria. Each compares the contrast ratio of two colors with a minimum, and this tool tests all of them at once.

Success criterionApplies toMinimum
1.4.3 Contrast (Minimum), level AANormal text4.5:1
1.4.3 Contrast (Minimum), level AALarge text3:1
1.4.6 Contrast (Enhanced), level AAANormal text7:1
1.4.6 Contrast (Enhanced), level AAALarge text4.5:1
1.4.11 Non-text Contrast, level AAUI components and meaningful graphics3:1

Large text is at least 18 point, or at least 14 point if bold. At 1pt = 1.333px that is about 24px, or about 18.67px bold (the W3C Understanding document rounds this to about 18.5px). Logos, incidental text and inactive controls are exempt.

How the ratio is calculated

Each color is converted to relative luminance: the sRGB channels are linearized and weighted 0.2126 red, 0.7152 green and 0.0722 blue. The ratio is (L1 + 0.05) ÷ (L2 + 0.05), with L1 the lighter color. It runs from 1:1 for two identical colors to 21:1 for black on white.

Rounding

The WCAG Understanding documents say the thresholds are exact and the computed value should not be rounded: 4.499:1 does not meet 4.5:1. This tool compares the unrounded ratio, shows it to four decimals under the main figure, and never displays a failing value rounded up onto a threshold. For example, #777777 on white is 4.4781:1 and shows as 4.48, a fail for AA normal text, while #767676 is 4.5422:1 and passes.

Transparent colors

A see-through text color has no contrast of its own: what the reader sees is the text color mixed with what is behind it. When the text color has an alpha value below 1, the tool blends it over the background first (the same source-over mix browsers use) and checks the result. A transparent background is first placed over white. For example, rgba(17, 24, 39, 0.6) over white is seen as #70747d, which gives 4.68:1. The same color fully opaque, #111827, gives 17.74:1.

How the suggested fixes work

When a level fails, the tool looks for the closest color that passes by changing only one property: OKLCH lightness. Hue and chroma stay the same, so a brand blue stays the same blue, just lighter or darker. It searches both lighter and darker, keeps whichever passes with the smaller change, and converts the result back to sRGB with the CSS Color 4 gamut mapping (which lowers chroma only if the color would fall outside sRGB). It does this for the text color and, separately, for the background.

Worked example

White text on a #3b82f6 button gives 3.68:1. That passes AA large text and the 3:1 check for UI components, but fails AA normal text, AAA normal text and AAA large text.

A gray example: #999999 on white is 2.85:1 and fails everything. The nearest passing text grays are #949494 (3.03:1), #767676 (4.54:1) and #595959 (7.00:1).

Common mistakes

Key terms

Contrast ratio
A WCAG measure of how different two colors' brightness is, from 1:1 (identical) to 21:1 (black on white). It is calculated from the relative luminance of each color and used to judge whether text is readable against its background.
Large text
In WCAG 2, text of at least 18 point, or at least 14 point if bold, which is about 24px or 18.67px bold in CSS. It needs a lower contrast ratio than normal text: 3:1 at AA and 4.5:1 at AAA.
Level AA
The middle of WCAG's three conformance levels (A, AA, AAA). For contrast it means 4.5:1 for normal text, 3:1 for large text and 3:1 for UI components and graphics.
Level AAA
The highest WCAG conformance level. Its enhanced contrast criterion, 1.4.6, needs 7:1 for normal text and 4.5:1 for large text.
Non-text contrast
WCAG 2.2 success criterion 1.4.11: the visual parts needed to identify controls and their states, and the parts of graphics needed to understand them, need at least 3:1 against adjacent colors.
Alpha blending
Mixing a partly transparent color with the color behind it. With source-over blending, each channel is the top value times alpha plus the bottom value times one minus alpha.
OKLCH lightness
The L of the OKLCH color space, from 0% (black) to 100% (white), designed so equal steps look roughly equally different. Changing only L keeps a color's hue and chroma.

Frequently asked questions

What contrast ratio does WCAG AA need?
4.5:1 for normal text and 3:1 for large text, under success criterion 1.4.3. User interface components and meaningful graphics need 3:1 under 1.4.11.
Is 4.49:1 close enough to 4.5:1?
No. WCAG treats the thresholds as exact and says the computed value should not be rounded, so anything below 4.5 fails AA for normal text.
What is the difference between AA and AAA contrast?
AAA is stricter: 7:1 for normal text and 4.5:1 for large text, against 4.5:1 and 3:1 for AA. AAA has no separate figure for UI components.
How does the checker handle transparent text?
It blends the text color over the background with its alpha value and checks the mixed color, because that is what is shown on screen. The note under the ratio gives the blended color.
Why does the suggested color look slightly different in hue?
The search keeps OKLCH hue and chroma, but the result is rounded to 8-bit sRGB, and very vivid colors may lose some chroma to stay inside the sRGB gamut. The change is usually too small to see.
Does contrast matter for buttons and input borders?
Yes. Under 1.4.11 a control's boundary, if it is the only thing that shows the control is there, needs 3:1 against the colors next to it. The same goes for focus indicators and icons that carry meaning.
Are my colors sent anywhere?
The check runs in your browser and the tool itself sends nothing. The two colors are saved in the page address, so you can share the link (which means they reach our server only when that link is opened), and in your browser's local storage, so they are still there next time.

Sources: WCAG 2.2 Contrast (Minimum), Understanding SC 1.4.3, Understanding SC 1.4.11, WCAG 2.2 contrast ratio definition, CSS Color 4 gamut mapping. Last checked 2026-11-17.