Is the text easy enough to read?
Is this text easy enough to read on this background?
Type the colour of the text and the colour behind it, or pick them. You get the contrast ratio, the grades of the Web Content Accessibility Guidelines it passes, the text on its background to look at, and the nearest colour that passes if it does not.
The two colours
Worked out on this device. The colours you type are not sent or kept.
The pair
Body text
Large text, 24 pixels
Normal text, 16 pixels. The lagoon was flat and the mountain stood in it twice.
A control3 to 1 is needed for its edge
7.14 to 1
- AA normal textNeeds 4.5 to 1 · WCAG 1.4.3Passes
- AA large textNeeds 3 to 1 · WCAG 1.4.3Passes
- AAA normal textNeeds 7 to 1 · WCAG 1.4.6Passes
- AAA large textNeeds 4.5 to 1 · WCAG 1.4.6Passes
- AA controls and graphicsNeeds 3 to 1 · WCAG 1.4.11Passes
Passes AAA for normal text and AA for everything.
The nearest colour that passes AA
This site’s own pairs
Worked out when the site was built, from the colours in its style sheet, by the same arithmetic as the checker above, so a change to a colour there changes this table. A row that fails for normal text and passes for large text is a colour that is fine for big or bold type and short of 4.5 to 1 for small print. Amber and blue on paper are for rules and underlines, and are measured here against the 3 to 1 that graphics need.
| Pair | Where it is used | Ratio | AA normal text | AA large text | Graphics, 3 to 1 |
|---|---|---|---|---|---|
| Body text | paragraphs on the page | 7.14 to 1 | Passes | Passes | Passes |
| Headings | titles and rules | 17.35 to 1 | Passes | Passes | Passes |
| Quiet text | captions and secondary lines | 7.14 to 1 | Passes | Passes | Passes |
| Quiet text on a sheet | notes inside a white card | 7.57 to 1 | Passes | Passes | Passes |
| Amber ink | a warning beside its label or icon | 4.73 to 1 | Passes | Passes | Passes |
| Violet on paper | a link on hover and a selected state | 5.37 to 1 | Passes | Passes | Passes |
| Dark panel | text on a night panel | 17.35 to 1 | Passes | Passes | Passes |
| Dark panel, white text | headlines on a night panel | 18.4 to 1 | Passes | Passes | Passes |
| Amber on a dark panel | the accent on a night panel | 8.57 to 1 | Passes | Passes | Passes |
| Main button | the main button: white words on the action blue | 6.7 to 1 | Passes | Passes | Passes |
| Navy on amber | a small highlight, words always navy | 8.57 to 1 | Passes | Passes | Passes |
| Green text | an approved or ready state | 4.71 to 1 | Passes | Passes | Passes |
| Blue on paper | rules and underlines, not text | 3.46 to 1 | Fails | Passes | Passes |
| Amber on paper | rules and underlines, not text | 2.02 to 1 | Fails | Fails | Fails |
How it works
The ratio is the one in the Web Content Accessibility Guidelines 2.2: (L1 + 0.05) ÷ (L2 + 0.05), where L is the relative luminance of the lighter and the darker colour. It is not the newer APCA method, which scores differently.
The grades: AA normal text needs 4.5 to 1; AA large text needs 3 to 1; AAA normal text needs 7 to 1; AAA large text needs 4.5 to 1; AA controls and graphics needs 3 to 1. Large text is 18 points (24 pixels) or more, or 14 points (about 18.7 pixels) or more in bold. The ratio is cut to two decimals, never rounded up, so a pair that shows 4.5 does pass and one that shows 4.49 does not.
The text colour moves toward black or toward white, a 255th of the way at a time, until the pair passes; the page offers the smaller move. A colour with some transparency is read as lying on its background, and a see-through background as lying on white.
The guidelines do not ask for a ratio on a logo, on text that is only decoration, on text that is not meant to be read, or on a control that is switched off. A ratio is one check. It says nothing of the size of the text, the space round it, colour used alone to carry a meaning, or how it looks to someone with colour blindness.
What it is built with
No library: the arithmetic is the guidelines’ own, written in this site’s code. contrast-ratio (MIT) is kept in the repository only to check it against.