Practical guide
Hex Color Contrast Checker
Use this checker while choosing foreground and background colors for ordinary interface text. It accepts two six-digit hexadecimal colors and reports the calculated ratio plus a pass/fail result for the tool’s 4.5:1 threshold.
How to use it
- Enter two colors separated by a comma, such as
#162033, #ffffff. - Select Run to calculate the contrast ratio.
- Check other states separately, including hover, disabled, focus, error, and visited-link colors.
Worked example
- Input
#000000, #ffffff- Result
- Contrast 21.00:1 · AA normal text passes
How the result is produced
Each sRGB channel is linearized, combined with relative-luminance coefficients, and compared using (lighter + 0.05) / (darker + 0.05).
The current pass label checks only whether the ratio is at least 4.5:1.
Important limits
- Only six-digit hex colors are accepted; shorthand, alpha, RGB, HSL, gradients, and images are not evaluated.
- The tool does not check text size, font weight, non-text controls, focus indicators, or complete accessibility conformance.
- Transparency and the actual composited background must be resolved before entering colors.
Questions and answers
Does a passing result make the whole page accessible?
No. Contrast is one requirement. Structure, keyboard support, labels, focus, zoom, motion, and many other factors still need review.
Which color should be entered first?
The ratio is symmetric, so foreground and background order does not change the numeric result.