Skip to content
CornerTools

Color Contrast Checker

Check text and background colours against WCAG AA and AAA, find the nearest colours that pass, and preview colour blindness.

Contrast ratio

4.83:1

WCAG 2.2, never rounded up to pass.

Body text at 16 px, the size most paragraphs use.

Large text at 24 px

Large bold text at 18.7 px

CheckNeedsResult
Normal text AASC 1.4.34.5:1Passes
Normal text AAASC 1.4.67:1Fails
Large text AASC 1.4.33:1Passes
Large text AAASC 1.4.64.5:1Passes
User interface and graphics AASC 1.4.113:1Passes

Large text is 18 pt (24 px), or 14 pt (about 18.7 px) bold. Select a row to find colours that pass it.

Measures the contrast between a text colour and its background the way WCAG 2.2 does, and shows which levels the pair meets: AA and AAA for normal and large text, and 3:1 for buttons, inputs and graphics. When a level fails, it finds the nearest lighter and darker colours that pass, changing whichever colour needs the smaller step. It also checks every pair in a palette at once, and previews the pair as people with colour blindness see it. Everything runs in your browser.

How to use it

Type any CSS colour into Text colour and Background (HEX, rgb(), hsl(), oklch(), a named colour and so on), or click a swatch to pick one; Swap exchanges them. A translucent text colour is drawn over the background, and a translucent background over white, as WCAG assumes for a page; the ratio is that of the colours as drawn. A colour outside sRGB is measured after mapping it to the nearest colour a screen shows.

The table lists each check with the ratio it needs. Select a row to set which level Nearest passing colours aims for (normal-text AA at first). Each suggestion keeps the colour's hue and chroma and changes only its OKLCH lightness, and shows its ratio and how far it is from the original (ΔE, in OKLab units × 100). A translucent text colour keeps its opacity; where no lightness can pass at that opacity, the tool says so and offers colours at full opacity.

Colour vision shows the pair under four deficiencies, with the ratio of the colours as simulated. Check a palette takes up to 12 colours, one a line or separated by commas, and gives a table of every colour as text on every other, with the highest text level each pair reaches. Share gives a link with both colours and the palette.

How it works

Each colour's sRGB channels are turned into linear light, a channel at or below 0.04045 divided by 12.92 and one above it raised as ((c + 0.055) ÷ 1.055)^2.4. Relative luminance weighs the three channels as the eye does, and the ratio compares the lighter luminance with the darker, from 1:1 for one colour to 21:1 for black on white. Older printings of WCAG gave 0.03928 in place of 0.04045, the sRGB standard's value; for 8-bit colours the two give the same results.

The ratio is shown to two decimals, but never rounded up across a threshold: 4.499:1 reads 4.49:1 and fails, as WCAG intends, while 4.5:1 exactly passes.

Suggestions are found by bisection on OKLCH lightness, each step mapped into sRGB and rounded to whole bytes, opacity included, so the HEX offered passes as written. Colour-vision previews use the Viénot, Brettel and Mollon (1999) projection for protanopia and deuteranopia, and Brettel, Viénot and Mollon (1997) for tritanopia, with the precomputed sRGB matrices of the public-domain libDaltonLens; achromatopsia keeps luminance only. They simulate full deficiency.

L = 0.2126 × R + 0.7152 × G + 0.0722 × B, with R, G, B in linear light
Contrast = (L₁ + 0.05) ÷ (L₂ + 0.05), L₁ the lighter

Examples

The lightest grey that passes on white

Text colour
#767676
Background
#ffffff

The ratio is 4.54:1: normal-text AA passes, AAA (7:1) does not.

One step lighter fails

Text colour
#777777
Background
#ffffff

The ratio is 4.478, shown as 4.48:1: it fails normal-text AA, though it passes AA for large text. The nearest darker grey that passes is #767676.

A brand blue as link text

Text colour
#3b82f6
Background
#ffffff

The ratio is 3.68:1, enough only for large text and controls. Changing the text colour is the smaller step: the nearest darker blue that passes normal-text AA is #2c72e5, at 4.52:1 and a ΔE of 5.

What WCAG 2.2 asks

1.4.3 Contrast (Minimum), level AA: text and images of text at least 4.5:1, and large-scale text at least 3:1. 1.4.6 Contrast (Enhanced), level AAA: 7:1, and 4.5:1 for large-scale text. Large-scale text is at least 18 point, or 14 point bold; at the CSS 96 pixels to the inch that is 24 px, or about 18.7 px bold.

1.4.11 Non-text Contrast, level AA: 3:1 against adjacent colours for the visual parts needed to identify user interface components and their states (a button's or an input's outline, a focus indicator, a checkbox) and for the parts of graphics needed to understand them.

None of these apply to text in an inactive control, pure decoration, text no one sees, text that is part of a picture with other significant visual content, or a logo. APCA, the method drafted for WCAG 3, is not used: WCAG 3 is a working draft, and WCAG 2.2 is the standard measured here.

Sources

Reviewed

Frequently asked questions

Yes. A placeholder is text, so 1.4.3 applies to it like any other; the pale greys many forms use often fail. Disabled controls are exempt.
One ratio cannot describe a background that changes. Check the text against the part of the background with the least contrast, usually its lightest or darkest area, or give the text a solid or translucent panel of its own and check that.
The WCAG 2 ratio ignores font weight and size beyond the large-text line, and rates light text on dark backgrounds a little generously. Thin fonts and small sizes need more than the minimum.

See also