What Is Color Contrast and Why Does It Matter?
Understand WCAG ratios and make your text readable for everyone.
Colour contrast is the difference in brightness between text and its background. When the difference is large, words stand out and are easy to read. When it is small, words fade into the background.
Low contrast is hard to read for people with low vision. A pair that looks fine on a bright office monitor may be unreadable outdoors, in bright sunlight, or on a dimmed phone screen.
What is a contrast ratio?
A contrast ratio measures how different two colours are in relative luminance — roughly, how light or dark each colour appears to the human eye.
The ratio is written as a number to one, such as 4.5:1. The scale runs from 1:1, where the colours are identical and the text is invisible, to 21:1, between pure black and pure white. A higher number means clearer text.
A ratio alone does not say whether a pair is good enough. That depends on text size and weight, and on the standard you are aiming for.
WCAG contrast levels: AA and AAA
WCAG sets out two levels most often used for contrast. AA is the level most websites aim for.
For normal text: AA normal text: 4.5:1 or higher. AAA normal text: 7:1 or higher.
For large text, the thresholds are lower, because larger, bolder letterforms are easier to read: AA large text: 3:1 or higher. AAA large text: 4.5:1 or higher.
Aim for AA as a minimum across your site.
What counts as large text?
WCAG defines large text narrowly. A heading is not automatically large text just because it looks bigger than the paragraph below it.
Large text means text at least 18 point (24 pixels) in size, or at least 14 point (about 18.66 pixels) and bold. That covers most main headings, but not ordinary bold body text, buttons, captions, or navigation labels.
If you are unsure whether text qualifies, test it against the normal-text threshold of 4.5:1.
Worked examples: a passing pair and a failing pair
Take a very dark navy, #12153A, on white, #FFFFFF. That pair has a contrast ratio of 17.59:1. It passes AA for normal text, because 17.59:1 is well above 4.5:1, and it passes AAA too, because it is above 7:1.
Now take a common failing pair: light grey text, such as #B0B0B0, on white. The grey is only slightly darker than the background, so the ratio falls below 3:1. That is below the AA threshold for normal text, and below the large-text threshold too, so it is likely too low for text of any size.
Check either pair in seconds with the Color Contrast Checker, which gives the ratio and the AA and AAA results.
How to fix a failing pair
When a pair fails, you do not usually need to change the colour completely. A small adjustment to lightness is often enough, and it keeps the design recognisable.
Change one side at a time. If the text is light grey on white, darken the text. If the background is pale and the text is white, darken the background. Re-check the ratio after each change.
Working in HSL — hue, saturation, lightness — makes this easier than guessing new hex values. Keep the hue and saturation roughly where they are, and move the lightness. Lowering the lightness darkens light grey step by step until it crosses 4.5:1. The Color Shades Generator can produce those darker steps for you.
Where a colour cannot change, such as a fixed brand colour, change the other side instead.
Contrast for buttons, icons, and borders
WCAG also asks for at least 3:1 for user interface components that carry meaning. That includes form-field borders, button outlines, visible focus indicators, and icons that convey information on their own.
A button label still needs to meet the text thresholds — 4.5:1 for normal text — but the button itself must also be identifiable against its background.
The same applies to icons. An icon that is the only way to understand an action, such as a search or menu icon, needs enough contrast to be seen clearly.
Contrast in dark mode and on images
A pair that passes on a light background does not automatically pass in dark mode. The background becomes dark and the text becomes light, so the pair is effectively reversed.
Text on images needs extra care. A photograph has light and dark areas, so one text colour may pass over one part and fail over another.
The safest fixes are to add a solid or semi-transparent background behind the text, darken the image with an overlay, or place the text in a plain area of the image.
Never rely on colour alone
Contrast helps people see that two things are different. It does not tell them what the difference means, so colour should never be the only way information is conveyed.
A form error shown only by turning a field border red is a common example. A reader who cannot distinguish red from grey may not notice the change. Pair the colour with words — "Please enter a valid email address" — and, where it helps, an icon.
The Color Blindness Simulator shows how a page looks under different types of colour vision. Use it alongside a contrast check, not instead of one.
How to test contrast, step by step
- List the pairs you use: body text, headings, links, captions, and button labels.
- Note the exact colours from your design or stylesheet, not from memory.
- Check each pair with a contrast checker, and note the ratio and AA and AAA results.
- Check the wider page with the WCAG Accessibility Checker.
- Test in dark mode, if you offer it, and text on images against the lightest area it covers.
- Fix failures by adjusting lightness in HSL, then re-check until the pair passes with a small margin.
- Check colour-alone issues, and make sure errors and links use words or icons as well as colour.
- Re-test after design changes, since a new image or brand colour can turn a passing pair into a failing one.
Common mistakes
Using light grey for secondary text. Muted text still needs to meet the normal-text threshold. Choose the darkest grey that still looks muted, and test it.
Testing only the main heading. Headings are large and bold, so they pass more easily. Body text, captions, and form labels are smaller and more likely to fail.
Forgetting placeholder text. Placeholder text is often light grey, and often the only hint about what to enter. Make sure it passes, or put the hint outside the field as a label.
Assuming a brand colour is fine. Brand colours are chosen for identity, not readability. A bright brand colour may work as a heading, but fail as small body text.
Checking on one screen only. Contrast looks different on different displays and in different lighting. A checker gives an objective ratio, so use it rather than judging by eye.
Frequently asked questions
What is a good contrast ratio? For normal text, 4.5:1 is the AA minimum and 7:1 is the AAA level. For large text, 3:1 meets AA and 4.5:1 meets AAA.
What is the difference between AA and AAA? AA is the standard level most websites aim for: 4.5:1 for normal text and 3:1 for large text. AAA is stricter: 7:1 for normal text and 4.5:1 for large text.
Does contrast matter if my site looks fine to me? Yes. Readers with low vision, older readers, and anyone reading in bright sunlight or on a dimmed screen will struggle with low contrast even when it looks fine to you.
Can I use light grey text if it is only a caption? Captions still need to be read, so they still need 4.5:1 for AA. Most captions are small, so plan for 4.5:1.
How do I fix a colour pair that fails? Adjust the lightness of one side of the pair. Darken light text on a light background, or deepen a pale background. Work in HSL, keep the hue, change only the lightness, then re-check until it passes.
Colour contrast is a small detail with a large effect. A few minutes checking your main text colours and fixing the pairs that fail can make a site noticeably easier to read. The Online Color Picker can help you choose replacement colours once you know what needs to change.