Contrast ratio
Ratio = (L1 + 0.05) ÷ (L2 + 0.05), where L1 is the luminance of the lighter colour
The 0.05 stands for ambient light reflected by the screen.
Compare text and background colors, calculate their contrast ratio, and quickly check the relevant WCAG AA and AAA thresholds.
Contrast ratio:
This checker calculates the contrast ratio between a text colour and a background colour using the WCAG method, then shows whether the pair passes the AA and AAA thresholds. Use it to validate a palette before adding it to a mock-up, a stylesheet or a component, without sending the colours to a server.
Each hexadecimal colour is converted into relative luminance: the red, green and blue channels are linearised, then weighted by how sensitive the eye is to each one (green accounts for over 70% of luminance).
The ratio divides the lighter luminance plus 0.05 by the darker luminance plus 0.05. It ranges from 1:1 (two identical colours) to 21:1 (black on white) and does not depend on the order of the two colours.
The result is compared with three thresholds: 4.5:1 for normal text at AA, 3:1 for large text at AA and 7:1 for normal text at AAA. A preview shows text in the two chosen colours.
Enter or pick the colour used for the characters.
Enter the colour of the background behind the text.
The ratio is shown with Pass or Fail for AA normal text, AA large text and AAA normal text.
Darken the text or lighten the background in small steps and check again.
The ratio compares the relative luminance of the two colours.
Ratio = (L1 + 0.05) ÷ (L2 + 0.05), where L1 is the luminance of the lighter colour
The 0.05 stands for ambient light reflected by the screen.
L = 0.2126 × R + 0.7152 × G + 0.0722 × B, with channels linearised between 0 and 1
A channel c (value out of 255 divided by 255) equals c ÷ 12.92 if it is at most 0.03928, otherwise ((c + 0.055) ÷ 1.055)^2.4.
Check that a brand colour stays readable as text on a white or dark background before rolling it out across a site.
Find the closest shade that reaches 4.5:1 when an audit flags grey text as too light.
Compare a button label with its background, then test the hover and disabled states.
This widely used grey narrowly misses AA: it works for large headings, not for body text.
Input
Text color: #777777 · Background color: #ffffffResult
Contrast ratio: 4.48:1 · AA normal text: Fail · AA large text: Pass · AAA normal text: FailA deeper grey reaches the AAA threshold of 7:1 exactly while staying softer than pure black.
Input
Text color: #595959 · Background color: #ffffffResult
Contrast ratio: 7.00:1 · AA normal text: Pass · AA large text: Pass · AAA normal text: PassIt is the luminance of the lighter colour divided by that of the darker one, each plus 0.05. It ranges from 1:1 for identical colours to 21:1 for black on white.
For level AA, 4.5:1 for normal text and 3:1 for large text. For level AAA, 7:1 for normal text. AA is the level required by most regulations, including the European standard EN 301 549.
Its ratio is 4.48:1, just below 4.5:1. The tool does not round in your favour: at 4.48, normal text does not reach AA.
No. The formula always puts the lighter colour on top, so white text on blue and blue text on white give the same ratio.
No. The tool compares two opaque colours. For a semi-transparent colour, first work out the colour it produces on the background, then check that colour.
No. The calculation runs in your browser and the colours never leave your device.
Related tools
Tools similar or complementary to this one.
Encode or decode a URL, its parameters, and any special characters it contains.
Turn a title or phrase into a clean slug that is ready to use in a URL.
Validate, normalize and inspect web addresses locally.
Understand WCAG contrast thresholds, measure color combinations, and fix cases that make an interface harder to read or use.
Resize a batch of images, convert them to WebP and remove metadata with one reusable Pipeline.
Resize, compress and choose between WebP, AVIF and other formats with a practical workflow that reduces file size without unnecessary visual loss.
WebAssembly, browser APIs and faster devices enable more processing locally. How far can this approach replace services that upload files to servers?