Color Contrast Checker (WCAG)

Check two colours against the WCAG contrast thresholds, with the large text rule applied correctly and the nearest passing colour offered.

Enable JavaScript to check your own colours; the result below is for the defaults.

Hex, with or without the hash, or an rgb() value.

The colour actually behind the text, not the page background, if they differ.

From 24px, or 18.66px when bold, WCAG applies its large text thresholds instead.

: 1

  • AA text
  • AAA text
  • Icons and borders

The quick brown fox jumps over the lazy dog.

Smaller supporting text, same two colours.

Check a text colour against its background and see which WCAG thresholds it clears, with the large text rule applied properly and the nearest passing colour offered when it fails.

How to use

  1. Enter the colour of the text and the colour actually behind it. If the text sits on a card, that is the card’s colour, not the page’s.
  2. Set the size the text is really used at. At 24px, or 18.66px when bold, WCAG switches to its large text thresholds, and a colour that fails at body size can pass there.
  3. Read the three verdicts: AA text is the legal baseline in most places, AAA is the stricter target, and icons and borders have their own 3:1 rule whatever the size.
  4. When AA fails, the nearest passing colour is offered. It keeps your hue and moves the lightness, so it still looks like your brand.
  5. Check the preview. A ratio that passes can still be hard to read at small sizes with a thin weight.

Example

A blue that works for headings and not for body text:

#1E56EC on #FFFFFF is 5.84:1

16px regular:  AA pass, AAA fail
24px regular:  AA pass, AAA pass  (large text thresholds)
Icons/borders: pass

The ratio does not change with size; the threshold does. 5.84:1 has to beat 4.5 for AA body text and only 3 for large text, which is why making text bigger can turn a near miss into comfortable headroom.

Pitfalls

  • Large text is 24px, or 18.66px (14pt) when bold. It is about the rendered size, not the tag: an h3 styled at 16px is body text as far as WCAG is concerned.
  • The thresholds apply to the colour behind the text, which on a gradient or an image is not one colour. Test the worst point.
  • Contrast is only part of legibility. A thin weight at 4.5:1 can read worse than a regular weight at 4.0.
  • Placeholder text, disabled controls and low-emphasis captions are still text. The exemption in WCAG covers incidental and decorative text, not “unimportant” text.
  • Icons, form borders and focus rings need 3:1 against what is next to them, which is a rule people meet by accident and break on purpose.
  • Semi-transparent colours are composited before the ratio is computed. Work out the resulting colour first; this tool reads the alpha channel but ignores it.
  • WCAG 2 contrast is a known-imperfect model, especially for dark backgrounds. APCA in WCAG 3 is the successor, but AA compliance today is still measured with this formula.
  • Passing at AA does not mean the design is accessible. It is one measurable part of one guideline.

Compatibility

The maths is the WCAG 2.1 relative luminance and contrast ratio formula, unchanged since WCAG 2.0 in 2008, and is what every audit tool and legal standard currently measures against. Hex, shorthand hex and rgb() inputs are accepted. Everything runs in your browser; nothing you type is uploaded.

Frequently asked questions

What ratio do I actually need?
4.5:1 for body text at AA, 3:1 for large text, 7:1 for body text at AAA. Icons and borders need 3:1.
Why does the same colour pass at one size and not another?
The ratio is fixed by the two colours. The threshold changes: large text is allowed 3:1 instead of 4.5:1.
What counts as large text?
24px regular, or 18.66px bold. It is the rendered size, not the heading level.
Does this handle transparency?
It reads a colour with an alpha channel but ignores the alpha. Composite it against the background first and test the result.
Is AA enough?
It is the level most laws and procurement rules reference. AAA is better where you can reach it, particularly for long-form reading.
Weekly drops

New tools, when there are new tools

One email when something worth using ships. No schedule to fill, so no filler.

Your address goes nowhere else, and one click unsubscribes.