Color Contrast Ratio Calculator
Compare two opaque sRGB colors, inspect a text preview and check WCAG 2.2 contrast thresholds for normal and large text.
YOUR CALCULATION
Result
—
Calculation steps
Work through one step at a time or reveal the complete calculation. The steps use your current inputs.
How to calculate
Convert sRGB channels to linear light, calculate each relative luminance, then divide the lighter luminance plus 0.05 by the darker luminance plus 0.05. Compare the unrounded ratio with each threshold.
Contrast ratio=(lighter luminance+0.05)/(darker luminance+0.05)
Worked example
Black on white has ratio 21:1. Identical colors have ratio 1:1. #336699 on white is approximately 5.998:1.
Assumptions and input details
Opaque three- or six-digit HEX sRGB only. AA thresholds are 4.5:1 for normal text and 3:1 for large text; AAA thresholds are 7:1 and 4.5:1. Large text means at least 18 pt regular or 14 pt bold. Threshold decisions use the unrounded ratio, even if the displayed value rounds upward. This checks the specified color pair, not complete accessibility conformance, gradients, transparency or image backgrounds. The preview is illustrative; the mathematical ratio uses the input colors.
References: W3C contrast minimum · W3C relative luminance
Using this calculator
Can I enter my own problem?
Yes. Replace the example values with your own inputs. The result, calculation steps, tables and applicable diagrams update from those inputs. Blank or invalid values clear the result; example values are never silently substituted for missing inputs.
Are the results exact?
Results use floating-point arithmetic and displayed rounding. Read the formula, assumptions and any stated data precision before interpreting the result.
Is my input uploaded?
The calculation runs in your browser. No account, file upload or external AI service is required. Inputs are not saved between page reloads.
Convert opaque sRGB color codes between HEX, integer RGB and HSL. See unrounded channel values and the nearest 8-bit HEX representation.
Convert pixel dimensions, print dimensions and pixels per inch. Find physical print size, required whole pixels or effective image resolution.
Enter a screen diagonal and pixel resolution to calculate active width, height, aspect ratio, pixel density and pitch, with a dimensioned screen diagram.
Reserved advertising space.