Contrast Ratio Checker (WCAG Text and Background Colors)
About this tool
Calculate the contrast ratio from HEX text and background colors. For translucent text, you can also see the color produced when it is composited over the background. Use the preview to check whether body text and large headings meet the WCAG 2.2 text contrast requirements (AA and AAA). All processing happens entirely in your browser (no data is sent).
Choose text and background colors
Enter a 3- or 6-digit HEX value (for example, #fff or #767676), or use the color picker. Text colors also accept 4- or 8-digit HEX values with opacity (for example, #0008 or #00000088). The leading # is optional.
Contrast ratio 4.54:1
This is how body text looks with these colors. Aa 123
| Text size | AA | AAA |
|---|---|---|
| Normal text | Pass (≥ 4.5:1) | Fail (≥ 7:1) |
| Large text | Pass (≥ 3:1) | Pass (≥ 4.5:1) |
Examples: gray text on a white background
Keep the background white (#ffffff) and make the text gradually darker to see these changes.
#777777is approximately 4.48:1. Large headings meet AA, but normal body text falls just below the AA requirement of 4.5:1.#767676is approximately 4.54:1. Normal body text also meets AA.#000000(black) gives 21:1. Both body text and headings meet AAA.
Using translucent black for supplementary text
For a note below body text on a white background, setting the text color to #0008 produces the composited color #777777 . Its contrast ratio is about 4.48:1, below AA for normal text. Increasing the final opacity digit by one to #0009 gives the composited color #666666 and a ratio of about 5.74:1, which meets AA.
In CSS, #RGBA represents the same color as #RRGGBBAA with each digit repeated twice. A final 00 means fully transparent, while ff means opaque. CSS HEX color notation (W3C)
Interpreting the results
Large text is generally at least 18 pt in regular weight or 14 pt in bold. For Japanese and other scripts, use an equivalent character size. Ratios are displayed to two decimal places; pass or fail is determined before rounding.
Translucent text is calculated over an opaque, solid background. Each sRGB red, green and blue channel is blended according to opacity, then rounded to the nearest 8-bit value (0–255). The resulting color is used for the preview and luminance calculation. For a translucent background, enter its final color after compositing over the underlying color. For photos or gradients, check the background area with the lowest contrast against the text. Alpha compositing formula (W3C)
For colors specified in RGB or HSL, convert them to HEX with the color code converter.
The checks are based on the W3C explanations of WCAG 2.2 Success Criterion 1.4.3 (AA) and Success Criterion 1.4.6 (AAA).