WCAG Color Contrast Checker
Check if your foreground and background colors meet WCAG 2.1 accessibility standards. Shows AA and AAA pass/fail for normal and large text.
Runs in your browser. No data leaves your device.
About this tool
Calculates the contrast ratio between a text color and a background color with the WCAG 2.x relative luminance formula and reports pass/fail for AA and AAA at normal and large text sizes. Includes a live preview so designers and developers can check readability before shipping.
Features
- Foreground and background colors set by swatch popover (pad/wheel picker, eyedropper where supported, CSS color or name input) or by typing hex, rgb(), hsl(), or a CSS color name
- While a typed value is incomplete or not a color, the ratio shows -- and the badges stay neutral (no FAIL), with a hint under the field
- Contrast ratio shown to 2 decimals as N.NN:1
- Four pass/fail badges: AA Normal (4.5:1), AA Large (3:1), AAA Normal (7:1), AAA Large (4.5:1)
- Pass/fail uses the unrounded ratio, so a value displayed as 4.50:1 can still fail if it is just under 4.5
- Swap Colors button
- Live preview with bold large text, a sentence at large size, and a small text sample
How to use it
- Set the Foreground (text) color with the swatch or by typing a hex value
- Set the Background color the same way
- Read the contrast ratio and the AA/AAA badges
- Use Swap Colors to test the reverse combination
Inputs
- Text fields: hex (#RGB, #RGBA, #RRGGBB, #RRGGBBAA), or any CSS color the browser accepts (rgb(), hsl(), named colors)
- Through the swatch popover: any CSS color or casual color name, converted to hex
Outputs
- Contrast ratio from 1.00:1 to 21.00:1
- PASS/FAIL for AA Normal, AA Large, AAA Normal, AAA Large
Limits and notes
- Uses the WCAG 2.x formula (sRGB linearization threshold 0.03928); it does not compute APCA / WCAG 3 contrast
- Transparency: a translucent foreground is blended over the background, and a translucent background over white, before the ratio is computed
- Checks text contrast only; no non-text (UI component, 3:1) badge
- Colors are not saved; the swatch popovers share the overtooled:color-picker:recent and overtooled:color-picker:mode localStorage keys with the Color Picker
- Runs entirely in the browser; nothing is uploaded
Keyboard shortcuts
- Escape: close an open color popover
Frequently Asked Questions
How does the Color Contrast Checker work?
The tool converts both colors to their relative luminance using the WCAG 2.1 formula: linearize each sRGB channel (apply gamma correction), then compute L = 0.2126*R + 0.7152*G + 0.0722*B. The contrast ratio is (L1 + 0.05) / (L2 + 0.05) where L1 is the lighter color. This ratio is then compared against WCAG AA (4.5:1 normal, 3:1 large) and AAA (7:1 normal, 4.5:1 large) thresholds.
What contrast ratio do I need for WCAG compliance?
WCAG AA requires 4.5:1 for normal text and 3:1 for large text (at least 18pt / about 24px regular, or 14pt / about 18.66px bold). WCAG AAA is stricter: 7:1 for normal text and 4.5:1 for large text.
What is the difference between AA and AAA?
AA is the standard compliance level required by most accessibility laws. AAA is the enhanced level for maximum readability. Most organizations target AA as the minimum, with AAA as a best practice.
How do I fix a failing contrast ratio?
Make the text color darker or the background lighter (or vice versa). Small adjustments often bring a failing combination into compliance. The tool shows the exact ratio so you can see how close you are.