Color Contrast Checker
Enter a text and a background color, with opacity, to get the WCAG contrast ratio and AA and AAA pass or fail for normal and large text. How it works
Use the Color Contrast Checker
About the Color Contrast Checker
WCAG level AA needs a contrast ratio of at least 4.5:1 for normal text and 3:1 for large text, and level AAA needs 7:1 and 4.5:1. White on black is 21:1. The checker computes the exact ratio of two colors and shows it truncated to two decimals, never rounded up, so #ef0000 on white (4.4966:1) reads 4.49:1 and fails AA for normal text. A fifth card checks the 3:1 non-text rule for icons and borders, and a failing text color gets a suggested replacement.
WCAG 2.1 and 2.2 text contrast thresholds
| Level | Normal text | Large text |
|---|---|---|
| AA (success criterion 1.4.3) | 4.5:1 | 3:1 |
| AAA (success criterion 1.4.6) | 7:1 | 4.5:1 |
Large text is at least 18 pt, or at least 14 pt and bold. WCAG 2.2 keeps the same values.
Text colors on white: ratio and pass or fail
| Text color | Ratio shown | AA normal | AA large | AAA normal | AAA large |
|---|---|---|---|---|---|
| #000000 | 21.00:1 | Pass | Pass | Pass | Pass |
| #595959 | 7.00:1 | Pass | Pass | Pass | Pass |
| #767676 | 4.54:1 | Pass | Pass | Fail | Pass |
| #777777 | 4.47:1 | Fail | Pass | Fail | Fail |
| #808080 | 3.94:1 | Fail | Pass | Fail | Fail |
| #949494 | 3.03:1 | Fail | Pass | Fail | Fail |
| #ff0000 | 3.99:1 | Fail | Pass | Fail | Fail |
| #ef0000 | 4.49:1 | Fail | Pass | Fail | Fail |
| #0000ff | 8.59:1 | Pass | Pass | Pass | Pass |
The ratio is the exact value truncated (not rounded) to two decimals; pass or fail uses the exact value. #ff0000 is 3.9985:1 and shows 3.99.
How to use this tool
- Enter the foreground (text) and background colors with the pickers or as hex codes, #RGB or #RRGGBB.
- Read the ratio and the five cards: AA normal, AA large, AAA normal, AAA large and Non-text (UI and graphics, 3:1), each marked Pass or Fail.
- If AA normal text fails, press Apply on the suggested text color: the nearest lightness of the same hue that reaches 4.5:1.
- For a semi-transparent color, set its opacity and, if the background is see-through, a backdrop color; the checker draws the background over the backdrop, then the text over that, and measures the result.
Frequently asked questions
- What is the minimum contrast ratio for WCAG AA?
- 4.5:1 for normal text and 3:1 for large text. Large text is at least 18 pt, or at least 14 pt and bold. Text that is decoration, inactive or part of a logo has no contrast requirement.
- What contrast ratio does WCAG AAA need?
- 7:1 for normal text and 4.5:1 for large text. #595959 on white is 7.0047:1, shown as 7.00:1, and passes; #767676 is 4.54:1 and passes AAA only for large text.
- How is the contrast ratio calculated?
- Each color’s red, green and blue values are linearized, then weighted as 0.2126 R + 0.7152 G + 0.0722 B to give a relative luminance L. The ratio is (L of the lighter color + 0.05) ÷ (L of the darker color + 0.05).
- How do I fix a text color that fails AA?
- Change its lightness until the ratio reaches 4.5:1. The checker does this for you when AA normal text fails: it keeps the hue and saturation, moves the lightness up or down, whichever needs the smaller change, and shows the nearest color that passes with an Apply button. Gray #aaaaaa on white (2.32:1) becomes #767676 (4.54:1), and red #ff0000 (3.99:1) becomes #ee0000 (4.53:1).
- Why does a ratio that looks like 4.5 show as 4.49?
- The page truncates the ratio to two decimals instead of rounding it, because WCAG says a computed ratio of 4.499:1 does not meet 4.5:1. #ef0000 on white is 4.4966:1, so it shows 4.49:1 and fails; a pair that shows 4.50:1 passes.
- Does a passing ratio mean everyone can read the text?
- No. A ratio is a minimum for one pair of colors. It says nothing about font size, weight, spacing or other vision needs, and the color-blindness previews on the page are an approximate preview, not a clinical simulation.
Related Tools
View all toolsRGB to Hex
Convert RGB to a hex color code and back: rgb(255, 136, 0) is #FF8800. Paste #abc, ff8800 or 255,136,0; each channel is a whole number 0 to 255.
Color Picker
Pick a color or type a HEX, RGB or HSL value to get the other two, the CSS and CMYK forms, and its WCAG contrast ratio on white, black or a second color.
Hex to RGBA Converter
Convert hex to rgba(): #007BFF is rgba(0, 123, 255, 1). Reads 3, 4, 6 and 8-digit hex or rgb()/rgba(), sets the opacity, and gives hsla() and 8-digit hex.
Color Palette Generator
Make a 5-color palette from one hex color: monochromatic, complementary, analogous, triadic or split-complementary, with WCAG contrast for each swatch.
Color Mixer
Mix two to four hex colors by weight in OKLab, sRGB or linear light: red and blue at 50% give #8c53a2 in OKLab. Copy HEX, RGB, HSL, OKLCH or CSS color-mix().
CSS Gradient Generator
Build linear, radial and conic gradients from color stops, ten presets or the colors of an image you upload, then copy CSS, Tailwind, React or SCSS code.