Colour Contrast Ratio Calculator
Calculate the contrast ratio between two colours.
How to use Colour Contrast Ratio Calculator
1. Enter Foreground Colour, Background Colour. 2. Only opaque six-digit sRGB hex colours are compared. The displayed ratio rounds to two decimals and alone does not certify WCAG compliance; text size, weight, transparency and rendered backgrounds require separate assessment. 3. Select Calculate or press Enter. 4. Select Copy result to copy the answer, or Reset to clear the form and result.
Why use this tool?
Only opaque six-digit sRGB hex colours are compared. The displayed ratio rounds to two decimals and alone does not certify WCAG compliance; text size, weight, transparency and rendered backgrounds require separate assessment.
How the calculation works
Ratio = (lighter relative luminance + 0.05) ÷ (darker relative luminance + 0.05), using sRGB linearisation threshold 0.04045. Only opaque six-digit sRGB hex colours are compared. The displayed ratio rounds to two decimals and alone does not certify WCAG compliance; text size, weight, transparency and rendered backgrounds require separate assessment. Counts and dimensions use the declared rounding convention; other numbers display up to three decimal places where applicable. Nonzero subsecond durations are labelled. Durations round to the nearest second; nonzero subsecond durations are labelled. File-size output units are decimal. Changing an input label does not convert filled values.
Example
Worked example: Foreground Colour = "#000000"; Background Colour = "#FFFFFF". Result: 21:1.
Practical tip
Check the input labels and assumptions against the colour contrast ratio task before reusing the number.
Frequently asked questions
What exactly does Colour Contrast Ratio Calculator calculate?
Ratio = (lighter relative luminance + 0.05) ÷ (darker relative luminance + 0.05), using sRGB linearisation threshold 0.04045.
Which units or counting rules apply?
Only opaque six-digit sRGB hex colours are compared. The displayed ratio rounds to two decimals and alone does not certify WCAG compliance; text size, weight, transparency and rendered backgrounds require separate assessment.
Does this inspect, change or upload my files?
This page calculates the entered values or text in the browser. Numeric image/media tools do not transform files. Check the worked example and stated counting basis; the result does not certify device, search-engine or accessibility outcomes.