Stockertim Dictionary · Artificial intelligence · Technology
Contrast ratio
Also called colour contrast ratio, color contrast ratio, luminance contrast
In short
A measure of the difference in brightness between text and its background, used in published accessibility guidelines to judge whether text is readable.
- Beginner
- Ratio or metric
- Checked
In detail
Contrast ratio compares the relative luminance of two colours, usually text and the background behind it. Relative luminance is a value from 0 for pure black to 1 for pure white, calculated from a colour's red, green and blue values with weights that reflect how the eye sees brightness. The ratio runs from 1 to 1, where both colours are the same, to 21 to 1 for black on white.
The calculation adds 0.05 to the luminance of each colour and divides the lighter by the darker. The Web Content Accessibility Guidelines (WCAG), as published, set a minimum of 4.5 to 1 for normal text and 3 to 1 for large text at the basic conformance level, with higher figures for the enhanced level. Many design tools and checkers calculate the ratio automatically.
Contrast matters because low contrast makes text hard or impossible to read for people with low vision, colour vision differences or a screen in bright sunlight. AI image and layout tools often produce attractive pale palettes, text over busy photos and grey-on-grey interfaces that fail the published minimum, so the ratio is a practical check on generated designs.
At work, designers check every text and background pair, including text placed over images, and adjust colours until each pair meets the target set by their organisation.
Formula
Contrast ratio = (L1 + 0.05) / (L2 + 0.05)
- L1
- the relative luminance of the lighter colour, from 0 to 1
- L2
- the relative luminance of the darker colour, from 0 to 1
- 0.05
- a fixed amount added to each luminance in the published formula
Worked example
A designer checks text colours on a white background, whose relative luminance is 1.
- Black text, luminance 0: (1 + 0.05) / (0 + 0.05) = 21.
- Light grey text, luminance 0.2: (1 + 0.05) / (0.2 + 0.05) = 4.2.
- Darker grey text, luminance 0.18: (1 + 0.05) / (0.18 + 0.05) = 4.57.
The light grey, at 4.2 to 1, is below the published 4.5 to 1 minimum for normal text; the darker grey, at about 4.57 to 1, meets it.
In practice
Designers run contrast checks on brand palettes, buttons, charts and text over images, and record the ratios in the design system. Reviewers treat AI-suggested colour schemes as drafts until every text pair passes the target the organisation follows.
Watch out
- Contrast ratio uses relative luminance, not how different two colours look; red and green can look different yet have similar luminance.
- Text over a photo can pass in one place and fail in another; check the lightest and darkest areas behind it.
Learn it properly
Official sources
- Understanding contrast (minimum) · W3C Web Accessibility Initiative
- WCAG standards and guidelines · W3C Web Accessibility Initiative
Facts last checked on 3 November 2026.
Education, not advice: the Stockertim Dictionary explains what terms mean. It never recommends buying or selling anything.