edubun
English
1 / 19

3 / 6 · Intermediate

Colour contrast

Light grey #999999 on white has a contrast ratio of 2.85:1, well under the 4.5:1 that WCAG 2.2 asks for body text.

Jump to the 10 practice questions

You will learn

  • Read a contrast ratio and compare it with the WCAG thresholds
  • Pick text colours that pass AA and AAA

Before this: Heading structure and landmarks

1Explore

Measured, not guessed

Text that is pale against its background is hard to read for people with low vision, for many older readers and for anyone using a phone in sunlight. WCAG 2.2 does not leave "pale" to taste. It measures the relative luminance of the two colours, a number from 0 for black to 1 for white. It then compares them with the contrast ratio (L1 + 0.05) / (L2 + 0.05), where L1 is the lighter colour. The result runs from 1:1, a colour on itself, to 21:1, black on white.

Each choice shows the colour on white and its contrast ratio, computed with the WCAG formula.

Tap a choice: the code and the preview change together.

Text colour
<p style="font-size: 18px"><span style="color: #999999">Closed on public holidays.</span> <b>#999999 2.85:1</b></p>
Preview

2Problem

Black on white

What is the contrast ratio of #000000 on #ffffff?

:1

Hint

(1 + 0.05) / (0 + 0.05).

Solution

Answer: 21 :1

(1 + 0.05) / (0 + 0.05) = 21.

3Explain

The thresholds

Success criterion 1.4.3 Contrast (Minimum), at level AA, asks for at least 4.5:1 for normal text and 3:1 for large text, which WCAG defines as at least 18 point, or 14 point bold. Criterion 1.4.6 at level AAA raises these to 7:1 and 4.5:1. Criterion 1.4.11 Non-text Contrast asks for 3:1 for the parts of controls and graphics that people need to see, such as the border of a text field or the lines of a chart. Logos and text that is purely decorative or part of an inactive control are exempt.

Five text colours on white with their contrast ratios, computed with the WCAG 2.2 formula. #999999 fails, #767676 just passes AA, #595959 passes AAA.

4Problem

Normal text, AA

What contrast ratio does WCAG 1.4.3 require for normal body text?

:1

Hint

The lower number is only for large text.

Solution

Answer: 4.5 :1

Normal text needs at least 4.5:1 at level AA. The lower threshold for large text cannot be applied merely because the designer prefers a paler colour.

5Problem

Large text, AA

And for large text at level AA?

:1

Hint

18 point, or 14 point bold.

Solution

Answer: 3 :1

Large text (18 pt, or 14 pt bold) needs 3:1.

6Problem

Normal text, AAA

What is the minimum AAA ratio for normal text?

:1

Hint

Criterion 1.4.6.

Solution

Answer: 7 :1

Criterion 1.4.6 raises normal text to 7:1 for AAA. The 4.5:1 minimum belongs to AA and is not enough for that higher target.

7Explain

Values worth remembering

A few values are worth remembering. The grey #767676 gives 4.54:1 on white, and is often quoted as the lightest plain grey that passes AA; #777777 gives 4.48:1 and fails. The darker #595959 reaches 7.00:1 and passes AAA. Saturated colours can be misleading: pure red #ff0000 on white is only 4.00:1, while the deeper red #c01c28 reaches 6.11:1. Placeholder text inside form fields is a frequent failure, because designers often make it very light on purpose.

8Problem

The lightest passing grey

Which grey just passes AA on white?

Hint

4.48 is below 4.5.

Solution

Answer: #767676 (4.54:1)

The grey with 4.54:1 reaches the 4.5:1 threshold. The 4.48:1 grey falls below it, even though the two colours look very similar.

9Problem

#999999 for body text

Grey #999999 on white is 2.85:1. For body text it

Hint

2.85 is below 3.

Solution

Answer: fails AA

2.85 is below 4.5, and even below 3 for large text.

10Problem

Pure red

Pure red #ff0000 on white: contrast ratio to two decimals?

:1

Hint

The relative luminance of red is 0.2126.

Solution

Answer: 4 :1

L of red = 0.2126; 1.05 / 0.2626 = 4.00.

11Explain

Colour must not be the only cue

Contrast between text and background is half the story. Criterion 1.4.1 Use of Color, at level A, says colour must not be the only way information is shown. Red #c01c28 and blue #1a5fb4 both read well on white, but against each other their ratio is only 1.03:1. In greyscale, or to someone who cannot tell red from blue, they become the same grey. So a required field marked only by a red label, or a link that differs from the text around it only by colour, needs a second cue: a word, an icon, an underline.

Red #c01c28 and blue #1a5fb4 have almost the same luminance, so in greyscale they look nearly identical.

12Problem

Red against blue

Red #c01c28 and blue #1a5fb4 against each other are 1.03:1. What does that mean?

Hint

1.03:1 is almost no difference in brightness.

Solution

Answer: They look almost the same in greyscale

Equal luminance means the only difference is hue, which some people cannot see.

13Problem

A link shown only by colour

A link is shown only by being blue. Which fix meets 1.4.1?

Hint

Add a cue that does not depend on colour.

Solution

Answer: Add an underline

A second cue that does not depend on colour, such as an underline.

14Problem

The border of a text field

Which criterion asks for 3:1 for the border of a text field?

Hint

Controls and meaningful graphics.

Solution

Answer: 1.4.11 Non-text Contrast

1.4.11 covers controls and meaningful graphics.

15Practice

Make the note pass AAA

The note text is #999999, which gives 2.85:1 on white. Change its colour to #595959 so it passes AAA at 7.00:1.

Checks
  • note colour #595959
Your code
<style>
  body { background: #ffffff; }
  .note { color: #999999; }
</style>

<h1>Opening hours</h1>
<p class="note">Closed on public holidays.</p>
Preview
Hint

#595959 reaches 7.00:1.

A solution
<style>
  body { background: #ffffff; }
  .note { color: #595959; }
</style>

<h1>Opening hours</h1>
<p class="note">Closed on public holidays.</p>

16Practice

Bring back the underline

The link differs from the text around it only by colour. Bring back the underline with text-decoration: underline.

Checks
  • link underlined
Your code
<style>
  a { color: #1a5fb4; text-decoration: none; }
</style>

<p>Our sourdough uses a <a href="/starter">ten-year-old starter</a> and slow proving.</p>
Preview
Hint

A darker blue is still only colour.

A solution
<style>
  a { color: #1a5fb4; text-decoration: underline; }
</style>

<p>Our sourdough uses a <a href="/starter">ten-year-old starter</a> and slow proving.</p>

17Practice

Required in words

The email field is marked as required only by a red label. Add the word (required) inside the label so the cue is not colour alone.

Checks
  • label says required
Your code
<style>
  .req { color: #c01c28; }
</style>

<form>
  <label class="req" for="email">Email</label>
  <input id="email" type="email">
</form>
Preview
Hint

Put the word inside the label.

A solution
<style>
  .req { color: #c01c28; }
</style>

<form>
  <label class="req" for="email">Email (required)</label>
  <input id="email" type="email">
</form>

18Explain

Common mistakes

Mistake
<style>
  input::placeholder { color: #c8c8c8; }
</style>
<input placeholder="you@example.com">
Fixed
<style>
  input::placeholder { color: #757575; }
</style>
<label for="e">Email</label>
<input id="e" placeholder="you@example.com">

Pale placeholder text fails contrast and disappears when you type. Darken it and give the field a real label.

19

Summary

  • Contrast ratio = (L1 + 0.05) / (L2 + 0.05), from 1:1 to 21:1.
  • AA: 4.5:1 normal text, 3:1 large text (1.4.3); 3:1 for controls and graphics (1.4.11).
  • #767676 on white is 4.54:1; #999999 is 2.85:1.
  • Colour must never be the only cue (1.4.1).

Next unitUsing a page with the keyboard
Full text · The whole lesson as one text
The text colour starts at #999999 on a white background. Drag the Lightness slider down and watch the ratio pass 4.5:1 and then 7:1. Results are written as words as well as numbers.

Why contrast matters

Text that is pale against its background is hard to read for people with low vision, for many older readers and for anyone using a phone in sunlight. WCAG 2.2 does not leave "pale" to taste. It measures the relative luminance of the two colours, a number from 0 for black to 1 for white. It then compares them with the contrast ratio (L1 + 0.05) / (L2 + 0.05), where L1 is the lighter colour. The result runs from 1:1, a colour on itself, to 21:1, black on white. The colour theory course works through the formula step by step; here we use it.

The numbers to meet

Success criterion 1.4.3 Contrast (Minimum), at level AA, asks for at least 4.5:1 for normal text and 3:1 for large text, which WCAG defines as at least 18 point, or 14 point bold. Criterion 1.4.6 at level AAA raises these to 7:1 and 4.5:1. Criterion 1.4.11 Non-text Contrast asks for 3:1 for the parts of controls and graphics that people need to see, such as the border of a text field or the lines of a chart. Logos and text that is purely decorative or part of an inactive control are exempt.

Five text colours on white with their contrast ratios, computed with the WCAG 2.2 formula. #999999 fails, #767676 just passes AA, #595959 passes AAA.

A few values are worth remembering. The grey #767676 gives 4.54:1 on white, and is often quoted as the lightest plain grey that passes AA; #777777 gives 4.48:1 and fails. The darker #595959 reaches 7.00:1 and passes AAA. Saturated colours can be misleading: pure red #ff0000 on white is only 4.00:1, while the deeper red #c01c28 reaches 6.11:1. Placeholder text inside form fields is a frequent failure, because designers often make it very light on purpose.

Checking colours in practice

You rarely need to work the formula by hand. When you inspect a text element, the colour picker in the developer tools of major browsers shows its contrast ratio against the background, often with a line marking the AA and AAA thresholds. Two cases need extra care. Text over a photo or gradient needs contrast checks wherever it appears. Dark text may fail on dark areas; light text may fail on light areas. A solid panel behind it can help. And a site with a dark theme needs checking twice, because a colour that passes on white can fail on near-black: the blue #1a5fb4 gives 6.29:1 on white but only 3.34:1 on pure black.

Never colour alone

Contrast between text and background is half the story. Criterion 1.4.1 Use of Color, at level A, says colour must not be the only way information is shown. Red #c01c28 and blue #1a5fb4 both read well on white, but against each other their ratio is only 1.03:1. In greyscale, or to someone who cannot tell red from blue, they become the same grey. So a required field marked only by a red label, or a link that differs from the text around it only by colour, needs a second cue: a word, an icon, an underline.

Red #c01c28 and blue #1a5fb4 have almost the same luminance, so in greyscale they look nearly identical.

AA: 4.5:1 for body text, 3:1 for large text and for UI parts. AAA: 7:1 for body text. Black on white is 21:1.

Key points
  • Contrast ratio = (L1 + 0.05) / (L2 + 0.05), from 1:1 to 21:1.
  • AA: 4.5:1 normal text, 3:1 large text (1.4.3); 3:1 for controls and graphics (1.4.11).
  • #767676 on white is 4.54:1; #999999 is 2.85:1.
  • Colour must never be the only cue (1.4.1).

Decide which threshold applies before judging a colour pair. Check whether the text actually qualifies as large, then compare the measured ratio with the appropriate level. Do not round a failing value upward to make it pass: the example at 4.48:1 still falls below 4.5:1. After checking legibility, remove the colour cue in your mind and ask whether a required field or link still has another way to be recognised.

Practice questions from Colour contrast on edubun

Embed this quiz

Free to embed. Please keep the credit line.

Sources for this course (8)
  • W3C, Web Content Accessibility Guidelines (WCAG) 2.2, W3C Recommendation first published 5 October 2023, current edition 12 December 2024 (w3.org/TR/WCAG22/, checked 2026-10-17)
  • W3C WAI, What's new in WCAG 2.2 (w3.org/WAI/standards-guidelines/wcag/new-in-22/, checked 2026-10-17)
  • W3C WAI, Images tutorial and alt decision tree (w3.org/WAI/tutorials/images/decision-tree/, checked 2026-10-17)
  • W3C, Using ARIA (w3.org/TR/using-aria/, Discontinued Draft 24 February 2026, rules 1 to 4, checked 2026-10-17)
  • W3C WAI-ARIA Authoring Practices Guide, Read Me First, "No ARIA is better than bad ARIA" (w3.org/WAI/ARIA/apg/practices/read-me-first/, checked 2026-10-17)
  • MDN Web Docs, tabindex (developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/tabindex, checked 2026-10-17)
  • MDN, Heading elements, accessibility notes (developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/Heading_Elements, checked 2026-10-17)
  • MDN, autocomplete attribute (developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/autocomplete, checked 2026-10-17).

Checked: 2026-10-17