Color Contrast Checker
Check WCAG text contrast with alpha compositing, a live preview and an accessible color suggestion.
Your result
About this tool
Check a text and background color pair using WCAG relative luminance. Semi-transparent text is composited over the opaque background before the ratio is calculated. Compare normal and large-text AA/AAA thresholds, inspect the opacity and luminance working, and download CSS for the entered pair and a suggested opaque alternative.
Check the pair you actually plan to use
- Enter the text and opaque background as #RGB or #RRGGBB, or use either color picker. Text opacity is a separate number from 0 to 1; a value of 0.5 is half opacity, not 50. Background opacity, gradients and images are not modelled.
- Compare the entered specimen with the suggested opaque specimen. A suggestion can retain the same hex color while changing opacity to 1. The normal-text AA suggestion is not necessarily sufficient for normal-text AAA.
- Open the luminance working when a pair is near a threshold. Pass/fail uses the unrounded ratio. Download CSS to retain both pairs, then recheck the actual page, including hover, focus and disabled states.
How the calculation works
Linearize each sRGB channel, then luminance=0.2126R+0.7152G+0.0722B. Contrast=(lighter luminance+0.05)/(darker luminance+0.05). Text compositing uses opacity×foreground+(1−opacity)×background.
Worked example
Black text on white has a 21:1 ratio and passes AA and AAA normal text. #777777 on white is approximately 4.48:1, narrowly below the 4.5:1 normal-text AA requirement.
Opacity can change a passing hex pair into a failing pair
Black (#000000) over white (#ffffff) has a 21:1 ratio at full opacity. At 0.5 foreground opacity, the effective sRGB channels are 127.5, 127.5 and 127.5, and the ratio is approximately 3.976653:1. That meets large-text AA but fails normal-text AA. The exported entered-pair CSS keeps this opacity rather than silently converting it to opaque black.
A rounded hex approximation can slightly change the result near a threshold. The specimen uses the original foreground and opacity; the calculation and channel table keep the unrounded composited values.
What the suggested color does and does not solve
The search samples blends of the entered foreground toward black and toward white, at full opacity, and keeps the first qualifying normal-text AA alternative with the smallest sampled blend amount. It is a practical suggestion, not a globally closest perceptual color or a whole-site accessibility assessment.
The four text checks are reported separately. A ratio of at least 4.5:1 meets normal-text AA and large-text AAA; 3:1 is only the large-text AA threshold, while normal-text AAA needs 7:1. Interface boundaries, focus indicators, non-color cues and keyboard access require their own checks.
Checking colors for a printed QR code?
The contrast ratio above measures text readability. To check a QR code, preserve its clear border, proof it at final print size and scan it with the intended device. A design can pass a text contrast threshold and still produce a code that is too small or distorted to scan.
Assumptions and limitations
Accepts opaque #RGB/#RRGGBB background and a separate foreground alpha. No background image or gradient analysis. Suggested color uses sampled blends toward black/white at opacity 1; it is not a globally minimal perceptual edit. The color specimens intentionally display the tested colors, including failing pairs. CSS export retains foreground opacity in the entered rule.
Large text is at least 18 pt, or 14 pt bold. Passing contrast alone does not prove accessible labels, keyboard interaction, focus, state communication or full WCAG conformance.
Sources and editorial responsibility
Maintained by Renvoro Pty Ltd. Sources inform the methods and assumptions shown here; outputs have the limitations described on this page.
Common questions
Does foreground opacity affect the contrast ratio?
Yes. The tool composites the foreground over the solid background first and uses the resulting displayed color in the ratio.
Can I check text on a gradient or photo?
Check the relevant background colors separately. This tool compares one solid background with one foreground and does not sample an image or gradient.
Does a passing ratio make an interface accessible?
It checks the selected colors against contrast thresholds. Check text size, focus indicators, state changes and other accessibility requirements separately.
Guide updated 2026-11-19. Calculation method and source dates remain separate.
Method reviewed 2026-10-13. Calculation standards · Report an issue