Skip to content
IndexRequest a UIAboutContact

Contrast Ratio Checker

Pick a text and background colour and see the WCAG contrast ratio with AA and AAA verdicts.

Open alone ↗

AI prompt

PROMPT: PASTE INTO YOUR AI IMAGE OR VIDEO TOOL
Clean infographic for designers titled Contrast Ratio: two large colour swatches, dark text on a pale background and mid-grey text on white, each with the word Aa in a large size and a ratio such as 12.6:1 and 2.8:1 beneath, green pass badges for AA and AAA on the first and a red fail badge on the second, flat vector style, plenty of white space, no gradients or shadows. Negative: decorative clutter, tiny text, wrong numbers, photos. Reduced motion: static graphic.

About this pattern

Definition

Contrast ratio compares the brightness of two colours on a scale from 1 to 21. WCAG asks for at least 4.5 for normal text and 3 for large text at level AA, and 7 and 4.5 at AAA. It is computed from relative luminance, not from how different the hues look.

When to use it

  • Use it before choosing grey text on white; light greys often fail.
  • Large text (24px or 19px bold) only needs 3.
  • Colour alone should never be the only signal; pair it with shape or text.

What the controls do

  • Two colour pickers, four sample pairs and four pass or fail badges.

Motion & timing

  • Results update on every change; there is no animation.
  • Reduced motion: nothing to change.

Tips & variations

  • Test both light and dark themes separately.
  • Test the hover and disabled states as well as the default one.

Code of this live preview

HTML
<div class="bx"><div class="rw" style="grid-auto-flow:column;justify-content:start;gap:14px"><label class="rw">Text<input id="fg" type="color" value="#767676"></label><label class="rw">Background<input id="bg" type="color" value="#ffffff"></label></div><div class="pr" id="pr"><b>Aa</b> <span>The quick brown fox jumps over the lazy dog.</span></div><div class="bd" id="bd"></div><div class="pre" id="pre" role="group" aria-label="Pairs"><button data-p="0" aria-pressed="true">Dark on pale</button><button data-p="1" aria-pressed="false">Grey on white</button><button data-p="2" aria-pressed="false">White on blue</button><button data-p="3" aria-pressed="false">Black on yellow</button></div></div>

Related patterns

Tint, Shade & Tone Ramps

↗
Tint, Shade & Tone RampsColour Techniques

60-30-10 Colour Rule

↗
60-30-10 Colour RulePalettes by Concept

Colour Harmony Wheel

↗
Colour Harmony WheelPalettes by Concept