Field guide for designers & makers
Readable color: a practical guide to WCAG contrast
Low contrast is the most common accessibility failure on the web, and the easiest to fix. One in twelve men has some form of color vision deficiency, and everyone loses contrast sensitivity with age, glare and cheap screens. A pairing that passes is a pairing more people can read.
01How the contrast ratio is calculated
WCAG compares the relative luminance of the two colors: how bright each one appears, weighted for the eye’s sensitivity to green over red and blue. Each sRGB channel is first converted to linear light:
c = channel / 255
linear = c ≤ 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ^ 2.4
L = 0.2126 R + 0.7152 G + 0.0722 B
ratio = (L_lighter + 0.05) / (L_darker + 0.05)
The result runs from 1:1 (identical colors) to 21:1 (black on white). The 0.05 term models ambient light flare on a screen. The ratio is symmetric, so swapping text and background gives the same number, although it rarely looks the same.
02AA, AAA and what each level covers
| Content | AA | AAA | Criterion |
|---|---|---|---|
| Normal text | 4.5 : 1 | 7 : 1 | 1.4.3 / 1.4.6 |
| Large text | 3 : 1 | 4.5 : 1 | 1.4.3 / 1.4.6 |
| UI components, focus indicators, icons, chart lines | 3 : 1 | — | 1.4.11 |
| Logos, disabled controls, decoration | Exempt | Exempt | — |
AA is the level referenced by most accessibility laws and procurement rules, including the ADA guidance in the US, the European Accessibility Act through EN 301 549, and Section 508. AAA is not required for whole sites, but it is a good target for long-form reading such as articles, product descriptions and documentation.
03Large text and interface components
Large text is 18pt (24px) at regular weight or 14pt (about 18.66px) at bold. Bigger strokes are easier to read, so the requirement drops to 3:1. Be careful with thin weights: a 24px light weight renders like much smaller text and deserves the normal-text threshold.
Success Criterion 1.4.11 covers the parts of an interface people need to see to operate it:
- Input borders must reach 3:1 against the page if the border is the only thing showing where the field is.
- Focus indicators need 3:1 against the surrounding colors so keyboard users can find their place.
- Icons that carry meaning, such as a search glass or a cart, and the lines of a chart need 3:1 against their background.
- Button fills don’t have to contrast with the page if the button’s text label identifies it, but the label must still reach 4.5:1 against the fill.
04APCA, explained
The WCAG 2 formula treats contrast as symmetric and overstates the contrast of dark pairs: mid-grey text on black can pass at 4.5:1 and still be hard to read. The Accessible Perceptual Contrast Algorithm fixes both: it models light-on-dark and dark-on-light separately and returns a lightness contrast value Lc from about 0 to 106 for dark text, and from 0 to −108 for light text.
| |Lc| | Rough use |
|---|---|
| 90 | Preferred for body text and long reading |
| 75 | Minimum for body text (about 18px regular or 14px bold) |
| 60 | Content text that isn’t body copy (about 24px regular or 16px bold) |
| 45 | Headlines and large text (about 36px regular or 24px bold) |
| 30 | Minimum for placeholder text, disabled-looking text and meaningful non-text elements |
| 15 | Dividers and decorative elements; below this, things start to disappear |
APCA was explored for WCAG 3, but the current WCAG 3 working draft lists its contrast method as still to be decided, and no law requires APCA. Treat the reading as a second opinion: if a pair passes WCAG 2 but scores a low Lc, especially in a dark theme, it is worth making stronger.
05Fixing a failing pair without losing the palette
Lightening or darkening in HSL often shifts the hue and makes a brand color look dirty. Auto-Fix works in OKLCH, a perceptual color space in which lightness can change while the hue and colorfulness stay put:
- Convert the color to OKLCH and hold its hue and chroma.
- Search lightness in both directions, darker and lighter, using binary search until the rounded hex value reaches the target.
- If the new lightness pushes the color outside the sRGB range, reduce chroma just enough to bring it back.
- Rank every option by its OKLab difference (ΔE) from the original and recommend the smallest change.
Usually the text color should move and the background should stay, because backgrounds carry the layout. When a brand color fails as text, keep it for large headings, icons or accents where 3:1 is enough, and use a darker shade for body links.
06Beyond the number
- Never use color alone to signal state (1.4.1). Pair a red error border with an icon or message, and underline links inside body text.
- Check every state. Hover, focus, visited and selected colors each need to pass on their own.
- Check text on images against the lightest and darkest part of the image behind it, or add a solid or gradient scrim.
- Test dark mode separately. A palette that passes in light mode can fail when surfaces turn dark, and APCA is particularly useful there.
- Simulate color blindness. Red and green pairs that look distinct to you may share the same lightness, and the vision toggle above shows how they collapse.
To build a palette from a photo or artwork first, start with the Color Palette Extractor, then test the pairings here.