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
| Check | Needs | Result |
|---|---|---|
| Normal text AASC 1.4.3 | 4.5:1 | Passes |
| Normal text AAASC 1.4.6 | 7:1 | Fails |
| Large text AASC 1.4.3 | 3:1 | Passes |
| Large text AAASC 1.4.6 | 4.5:1 | Passes |
| User interface and graphics AASC 1.4.11 | 3:1 | Passes |
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
- Web Content Accessibility Guidelines (WCAG) 2.2 — W3C
- Understanding Success Criterion 1.4.3: Contrast (Minimum) — W3C
- Understanding Success Criterion 1.4.11: Non-text Contrast — W3C
- libDaltonLens — DaltonLens
Reviewed
Frequently asked questions
See also
- Color Palette Generator — to build a palette and a shade scale, with each swatch's contrast shown.
- Color Converter — to write a colour in HEX, RGB, HSL or OKLCH.
- Image Color Picker — to take the colours from a screenshot or design.