Developer Tools

WCAG Color Contrast: How to Check and Fix It

Low-contrast text locks people out. Learn the WCAG contrast rules, how the ratio is calculated, and how to check any colour pair instantly.

1 min read·Updated 2026-05-18

Why contrast matters

Text that looks fine to you can be unreadable for someone with low vision, ageing eyes or a glare-filled screen. The Web Content Accessibility Guidelines define minimum contrast ratios so your content stays legible for everyone.

The rules to remember

LevelNormal textLarge text
AA4.5 to 13 to 1
AAA7 to 14.5 to 1

Large text means 18pt regular or 14pt bold. Buttons, labels and captions count as normal text, so hold them to 4.5 to 1 even when they look big.

How the ratio is calculated

Each colour is converted to relative luminance using the sRGB formula, then the lighter and darker values are compared as (L1 + 0.05) / (L2 + 0.05). Because the lighter value is always the numerator, the result is the same whichever colour is the text.

Check any pair instantly

Enter your foreground and background hex codes in the WCAG Color Contrast Checker to see the ratio and the pass or fail result for AA and AAA. Try swapping the colours if you are unsure which is the text.

Fixing a failing pair

  1. Darken or lighten the text towards the extremes.
  2. Adjust the background rather than the brand colour.
  3. Use a slightly stronger shade from the same palette.
  4. Increase font weight or size where the rules allow large text.

Find colours to work with

Pull a palette from an existing image with the Color Palette Extractor, then convert between hex, RGB and HSL with the Color Converter. Testing each pairing as you design avoids accessibility fixes later.

Make it a habit

Contrast checking takes seconds and prevents a whole class of complaints and legal risk. Bake it into your design review so no low-contrast text ships by accident.

Tools used in this guide

Related guides