- Cost
- Free
- WCAG
- 2.2
Color contrast checker
WCAG 2.2 level AA asks for a contrast ratio of at least 4.5:1 between text and its background, and 3:1 for large text and for the parts of buttons, fields and icons that people need to see. Enter two colors to get the ratio and a pass or fail for each rule. Nothing is sent anywhere: the sum is done in your browser.
Hex, rgb(), hsl() or a CSS color name.
Hex, rgb(), hsl() or a CSS color name.
Contrast ratio
5.74:1
Passes AA for text of any size.
How to read the ratio, and how to fix a pair that fails
The checker uses the formula from the WCAG 2.2 glossary, so its numbers match what an auditor or an automated test will measure. The sections below explain the thresholds, the cases that catch people out, and the fixes that work without redoing a brand.
How to read the result
Contrast ratio runs from 1:1 (the same color twice) to 21:1 (black on white). It compares the relative luminance of the two colors, which is how bright each one looks once the red, green and blue channels are weighted the way the eye weights them. Green counts for most of it, blue for very little, which is why a saturated blue can look strong and still fail.
Five rows come back. Normal text at AA needs 4.5:1. Large text at AA needs 3:1. The AAA rows, from success criterion 1.4.6, ask for 7:1 and 4.5:1. The last row is 1.4.11, non-text contrast: 3:1 for the visual information that identifies a control or its state, and for the parts of a graphic needed to understand it.
The ratio on screen is cut to two decimals, not rounded. W3C says the computed values should not be rounded, so 4.499:1 fails the 4.5:1 threshold. Exactly 4.5:1 passes, because the rule reads "at least".
What counts as large text
WCAG defines large-scale text as at least 18 point, or 14 point bold. W3C gives the CSS equivalents as roughly 24px and 18.5px, using 1pt = 1.333px. So a 20px regular heading is not large text and needs 4.5:1, while 19px bold is large and needs 3:1.
The size is the size the text is set at, before anyone zooms. A heading that only becomes 24px on wide screens has to pass 4.5:1 on the phone layout where it is smaller.
Buttons, fields, icons and focus rings
Success criterion 1.4.11 covers what is not text. Visual information required to identify user interface components and their states needs 3:1 against the adjacent colors, and so do the parts of graphics required to understand the content.
In practice that means checking these pairs as well as the text:
- The border of a text field against the page, when the border is the only thing showing that the field is there. A pale grey outline is the most common failure of this rule.
- A focus indicator against the background it appears on.
- An icon that works as a button with no text label, against what is behind it.
- Chart lines, pie slices and map areas that carry meaning, against their neighbours.
- The checked and unchecked state of a checkbox or toggle, where color is what tells them apart.
Transparent colors, gradients and images
A color with an alpha value is not the color people see. The checker mixes a partly transparent text color with the background before measuring, and shows the color that results. A partly transparent background is placed on white first, following the W3C note that white is assumed when no background color is specified.
Text on a gradient or a photo has many backgrounds. Measure the text color against the lightest and the darkest point it crosses; both have to pass. If that is not possible, put a solid or semi-opaque panel behind the text and measure against the panel.
Fixing a pair that fails
When a pair fails, the checker offers the nearest text color that reaches 4.5:1 against the same background, and the nearest background that reaches it against the same text. Both keep the hue and saturation and only move lightness, so a brand blue stays recognisably blue. Press Use to try it.
Fixes that hold up in real sites:
- Keep the brand color for large headings, buttons with large labels and backgrounds, and use a darker shade of it for body text and links.
- Placeholder text in fields is text and needs 4.5:1. The light grey browsers and design kits default to often does not reach it.
- Check every state: hover, focus, visited links, error messages in red, and text on a selected row.
- If the site has a dark theme, every pair has to pass in that theme too. A token that works on paper white often fails on near-black.
- Store the passing pairs as design tokens, so the next page built does not pick a failing grey again.
What a two-color check cannot tell you
This checks one pair of colors you already know. It does not find the pairs on your pages, and it cannot see text over images, thin fonts that render fainter than their CSS color because of anti-aliasing, or a color set by a script after load. W3C allows text to be evaluated with anti-aliasing turned off, so very thin type can pass on paper and still look faint; check it by eye as well.
To find every failing pair, run the free scan on a page: it renders the page and measures the colors as the browser paints them. Contrast is also only one of the WCAG criteria a page has to meet, and many of the others need a person with a keyboard and a screen reader to judge.
Questions people ask
- What contrast ratio does WCAG AA require?
- 4.5:1 for normal text and 3:1 for large text, which is at least 18 point or 14 point bold (about 24px or 18.5px). Buttons, field borders, icons and other parts of the interface need 3:1 against the colors next to them under success criterion 1.4.11.
- Is 4.48:1 close enough to pass?
- No. W3C says the computed ratio should not be rounded, so anything below 4.5:1 fails, including 4.499:1. That is also why this checker cuts the ratio to two decimals instead of rounding it up.
- What does AAA need?
- Success criterion 1.4.6, Contrast (Enhanced), asks for 7:1 for normal text and 4.5:1 for large text. It is a higher bar than AA and worth meeting for long reading text.
- Do logos and disabled buttons have to pass?
- No. Text that is part of a logo or brand name has no contrast requirement, and neither does text in an inactive interface component, such as a disabled button. Pure decoration and text nobody can see are also exempt.
- Which formula does the checker use?
- The one in the WCAG 2.2 glossary: relative luminance L = 0.2126 R + 0.7152 G + 0.0722 B on linearised sRGB channels, and a ratio of (L1 + 0.05) / (L2 + 0.05) with the lighter color on top. It uses the 0.04045 threshold that replaced 0.03928 in May 2021.
- Is anything I enter sent to OAKMONT?
- No. The colors are parsed and measured in your browser. The address bar keeps the two colors so you can share the link to a pair, and that is all.
Where each statement comes from
Checked against the sources on .
