Colour Contrast Checker
Measure the WCAG contrast ratio between a text colour and its background, and see whether the pair passes AA and AAA.
Type a hex value (#rgb, #rrggbb or #rrggbbaa), rgb(), hsl() or a CSS colour name such as navy, or use the colour pickers. The result updates as you type.
Contrast ratio
–
| Requirement | Minimum | Result |
|---|---|---|
| AA normal text | 4.5:1 | – |
| AA large text | 3:1 | – |
| AAA normal text | 7:1 | – |
| AAA large text | 4.5:1 | – |
| UI components and graphics | 3:1 | – |
Nearest text colour that reaches 4.5:1
Same hue and saturation as your text colour, with only the lightness changed.
Preview
Normal text at 16px. Body copy like this needs 4.5:1 for AA and 7:1 for AAA.
Large text at 24px
Large bold text at 18.66px
Bordered control
Colour values
About the Colour Contrast Checker
This tool measures how strongly a text colour stands out from the colour behind it, using the contrast ratio defined in the Web Content Accessibility Guidelines (WCAG) 2.x. It then tells you, in words, whether the pair meets each WCAG level, shows the two colours in use, and suggests the nearest shade that passes when yours does not.
How to use it
- Enter the text colour and the background colour. Hex,
rgb(),hsl()and CSS colour names are all accepted, or choose with the colour pickers. - Read the ratio and the table of results. Each line says Pass or Fail against its minimum.
- If the pair fails AA, press Use this colour on a suggested shade, or adjust the colours yourself.
- Press Copy link to share the pair; both colours are stored in the page address.
What the ratio measures
The ratio compares the relative luminance of the two colours: how much light each one gives off as the eye perceives it, from 0 for black to 1 for white. To find it, each of the red, green and blue values is scaled to the range 0 to 1 and converted from its gamma-encoded sRGB value to linear light. The three are then added with weights of 0.2126 for red, 0.7152 for green and 0.0722 for blue, because the eye is far more sensitive to green than to blue.
The contrast ratio is the lighter luminance plus 0.05, divided by the darker luminance plus 0.05. It runs from 1:1 (two identical colours) to 21:1 (black and white), and it is the same whichever of the two colours is the text. Hue plays no part, which is why red on green of similar brightness scores badly even though the colours look very different to many people.
#767676 on white 4.54:1 passes AA for normal text
black on white 21:1 the maximum
WCAG does not allow rounding up to a threshold, so 4.499:1 fails a 4.5:1 requirement. This tool cuts the ratio to two decimal places without rounding for that reason.
The WCAG 2.2 thresholds
- Level AA, normal text – at least 4.5:1 (success criterion 1.4.3).
- Level AA, large text – at least 3:1.
- Level AAA, normal text – at least 7:1 (success criterion 1.4.6).
- Level AAA, large text – at least 4.5:1.
- User interface components and graphics – at least 3:1 against adjacent colours (success criterion 1.4.11, level AA). This covers things like input borders, icons, focus indicators and the parts of a chart needed to understand it.
Large text means at least 18pt, which is 24px in CSS, or at least 14pt bold, which is about 18.66px. Anything smaller counts as normal text.
Who it helps
Good contrast matters most to people with low vision, whose eyes need a stronger difference to make out letter shapes, and to people with colour vision deficiency, who may see two different hues as the same shade. It also helps everyone else in poor conditions: a phone screen in direct sunlight, a dimmed laptop, a cheap projector in a bright room.
The position in the UK
Public sector bodies are required to make their websites and mobile apps meet WCAG 2.2 level AA, and to publish an accessibility statement, under the Public Sector Bodies (Websites and Mobile Applications) (No. 2) Accessibility Regulations 2018. The regulations contain some exemptions. For other organisations there is no law that names a contrast ratio. The Equality Act 2010 places a duty on service providers in Great Britain to make reasonable adjustments for disabled people, and meeting WCAG AA is a widely used way of showing that a website is accessible, but the Act itself does not mention WCAG. This is general information, not legal advice.
What the ratio does not cover
- Font weight and size beyond the two bands. A thin, light typeface at 4.5:1 can be harder to read than a sturdy one, and the ratio cannot see that.
- Text over images and gradients. The background is not one colour, so check the point where the contrast is lowest, or put a solid panel behind the text.
- Placeholder and disabled text. Placeholder text in a form field is still text and needs 4.5:1. Inactive (disabled) controls, pure decoration and logos are exempt from the contrast requirements.
- Colour as the only signal. Passing contrast does not satisfy success criterion 1.4.1, which says information must not be conveyed by colour alone. A link inside a paragraph or an error state needs an underline, icon or wording as well.
- APCA. Earlier working drafts of WCAG 3 explored a different method, the Accessible Perceptual Contrast Algorithm, which takes account of font size and weight and of which colour is the text. The current draft has not yet chosen a contrast method, so APCA is not a requirement, and its scores cannot be compared with the ratios shown here.
Transparency
A semi-transparent text colour, such as rgba(0, 0, 0, 0.6) or an eight-digit hex value, is blended over the background first, and the ratio is measured on the colour that results. That is what a reader actually sees. If the background itself is semi-transparent, the tool assumes it sits on white, because it cannot know what is behind it on your page.
Limitations
- Colours are treated as sRGB with eight bits per channel. Newer CSS formats such as
oklch(),lab()andcolor()are not read; convert them to hex orrgb()first. - The hsl values shown are rounded to one decimal place, and alpha values to two.
- The suggested shade changes lightness only. It reaches 4.5:1, but a large change in lightness can move a brand colour a long way; treat it as a starting point.
- A passing ratio does not make text readable on its own. Long passages in capitals are slower to read whatever the colours; the case converter turns them back into sentence case, and the word counter gives the reading time of the copy itself.
Privacy
The calculation runs in JavaScript in your own browser. The colours are not sent to a server. They are added to the page address after you change them, so that the link can be shared; nothing else is stored.
Common questions
What contrast ratio does WCAG AA require?
WCAG level AA requires a contrast ratio of at least 4.5:1 for normal text and at least 3:1 for large text (success criterion 1.4.3). User interface components and meaningful graphics, such as input borders and icons, need at least 3:1 against adjacent colours (success criterion 1.4.11). Ratios may not be rounded up, so 4.49:1 fails the 4.5:1 requirement.
What contrast ratio does WCAG AAA require?
WCAG level AAA requires a contrast ratio of at least 7:1 for normal text and at least 4.5:1 for large text (success criterion 1.4.6). That is stricter than level AA, which asks for 4.5:1 and 3:1. The highest ratio possible is 21:1, for black on white, so a pair of colours that reaches 7:1 still sits well within the scale.
What counts as large text in WCAG?
Large text in WCAG means text of at least 18pt, which is 24px in CSS, or bold text of at least 14pt, which is about 18.66px. Anything smaller counts as normal text. Large text is allowed a lower contrast ratio because bigger, heavier letters are easier to make out: 3:1 at level AA and 4.5:1 at level AAA.
What is the lightest grey text that passes WCAG AA on white?
The lightest pure grey that passes WCAG AA for normal text on a white background is #767676, with a contrast ratio of 4.54:1. One step lighter, #777777, scores 4.47:1 and fails the 4.5:1 minimum. For large text, which needs only 3:1, lighter greys are allowed. Enter any pair in the checker on this page to see its exact ratio.