Color & Display

WCAG Contrast Ratio & Text Threshold Calculator

Compare two opaque sRGB colors against text contrast thresholds without rounding the ratio before assessment.

How the calculation works

Linearize sRGB channels at the 0.04045 breakpoint, calculate relative luminance, then contrast=(lighter+0.05)/(darker+0.05). Compare the unrounded result to the selected threshold.

Worked example

Example inputs — Foreground hex: #000000; Background hex: #FFFFFF; Custom ratio threshold: 4.5. Expected results — Foreground: #000000 sRGB hex; Background: #FFFFFF sRGB hex; Foreground relative luminance: 0; Background relative luminance: 1; Contrast ratio: 21 :1; Custom threshold assessment: Meets entered ratio; AA normal text ratio: Meets 4.5:1 ratio; AA large text ratio: Meets 3:1 ratio; AAA normal text ratio: Meets 7:1 ratio.

Assumptions and limits

Mathematical color model with stated reference conventions; device calibration, viewing conditions and color-management profiles affect practical appearance. Ratio assessment only, not a complete WCAG conformance audit. Large-text eligibility, exceptions, font rendering, gradients, images and actual background selection must be assessed separately. Inputs are opaque sRGB; composite transparent colors first. WCAG luminance coefficients are 0.2126, 0.7152, 0.0722.

Reference and further reading

Read the underlying subject reference. Calculith is an independent implementation; the reference does not endorse or certify this tool.

Related calculators

Browse all 1000 calculators →

Example values are editable. Results are estimates where assumptions apply. Calculations run in your browser. Updated 2026-11-16.