Practical guide
Check WCAG Color Contrast for Text and Controls
By MultiZest · Updated
How to use this tool
- Enter six-digit foreground and background HEX colors.
- Inspect the live preview and run the contrast check.
- Review the normal text, large text and non-text criteria in the report. Adjust the pair and check again.
Worked example
Black #000000 on white #ffffff gives a 21:1 contrast ratio and passes the displayed text criteria. White on white gives 1:1 and fails them. The preview alone is not a numerical test.
Which threshold applies?
Normal text requires at least 4.5:1 for AA and 7:1 for AAA. Large text requires 3:1 for AA and 4.5:1 for AAA. Large means at least 18 point regular or 14 point bold, not simply a heading element.
Essential non-text interface components generally use a 3:1 threshold against adjacent colors. Exceptions and context matter; a number cannot determine whether a particular icon is essential.
Use the actual rendered background
This calculation assumes opaque sRGB colors. Gradients, background images, transparency, antialiasing and overlays may produce different local contrast. Measure the least favorable rendered pair when backgrounds vary.
Pass/fail is calculated from the unrounded ratio. The display rounds to two decimals, so a value shown near a threshold can still fail. A passing pair alone does not establish WCAG conformance for a page.
Choose the pair that users actually have to read
For a button, compare the text color with the button background, then consider the button against the surrounding page. For body text, test the actual text and panel colors. A palette containing two attractive swatches does not establish that their combination is readable at a small size.
Try adjusting lightness before abandoning the whole palette. A darker variation of an accent can retain its character while making a label easier to read. Recheck the ratio after the adjustment and preview the result with realistic text, not only a large bold heading.
Look beyond a single successful ratio
Hover, disabled, focus and error states can use different colors from the default control. Check the states that carry essential information. A gradient or photograph also changes the background beneath individual letters, so a measurement from one convenient spot can overlook a less readable region.
Contrast is one part of accessibility. Keyboard access, visible focus, descriptive labels and alternatives for visual information still need review. Use this transparent numerical check as one step in testing the complete interface rather than presenting a passing color pair as certification for the whole website.
Questions and troubleshooting
Does this test transparency or gradients?
No. Enter the final opaque foreground and background colors. Gradient or image backgrounds need checks at their least favorable locations.
Does a contrast pass mean my website is fully accessible?
No. Keyboard operation, semantics, focus, alternatives and other criteria require separate checks.
Do I need to test hover and error colors too?
Yes, when those states carry information users need. Test the actual foreground/background pair for each relevant state and review the complete control’s accessibility separately.
Continue with a related tool
Click or tap an image pixel to inspect its HEX and RGB values in your browser.
CSS Gradient Generator →Create linear, radial, and conic CSS background gradients with live preview and code export.
Convert Image →Convert static images to PNG, JPG, or WebP locally. Animated images are exported as a still frame.
More detailed guides
Sources and further reading
Found an error or an unclear instruction? Report it. Read our editorial policy and privacy policy.