How to use it
- Enter a HEX value for the foreground and the background, or choose both colors with the pickers.
- Check the contrast and use the preview to see the pair at two text sizes. Swap the colors to see the reverse combination.
- Read the result for the size or visual element you are testing. For normal text, AA requires at least 4.5:1 and AAA requires at least 7:1.
Questions and answers
What is the highest possible contrast ratio?
Black on white or white on black gives 21:1. Two identical colors give 1:1.
Does reversing the colors change the ratio?
No. The formula divides the lighter luminance term by the darker one regardless of which color is used for the text. The preview still changes.
Can I enter CSS colors with opacity?
Use the final displayed solid color against its background. The fields accept 3- or 6-digit HEX colors without an alpha channel.
Common questions and fixes
What counts as large text for WCAG contrast?
For WCAG contrast, large text is at least 18 pt in regular weight or 14 pt in bold, roughly 24 or 18.67 CSS pixels, respectively. Large text needs 3:1 for AA or 4.5:1 for AAA. Smaller text needs 4.5:1 for AA or 7:1 for AAA.
Step by step
- Inspect the rendered text and check its computed font size and weight.
- Compare the computed size to the matching size rule. Check each size if your layout changes across screen widths.
- Enter the foreground and background colors and read the normal or large text row.
Which gray passes WCAG AA on a white background?
On pure white, #767676 reaches about 4.54:1 and passes AA for normal text. #777777 reaches about 4.48:1, below the 4.5:1 threshold. Set the actual background color before reusing either result on another surface.
Step by step
- Set the background to #FFFFFF and the foreground to #777777.
- Check the normal-text AA row, then repeat with #767676.
- If your design uses a different white, replace the background HEX with the real value and check again.
How do I check contrast for icons and button borders?
For WCAG 2.2 AA, compare a meaningful icon or the visual feature that identifies a control or state with its adjacent color. It generally needs at least 3:1 under non-text contrast. Test a button’s written label against its fill using the text criteria.
Step by step
- Find the visual cue needed to recognize the control or state.
- Sample that cue and the color immediately next to it. For a search icon inside a button, use the icon and button fill.
- Read the UI and graphics AA row. Then run a separate check for any text label.