# How to check color contrast for WCAG AA and AAA

> Measure the WCAG contrast ratio between text and background, learn the AA and AAA thresholds for text and UI components, and fix colors that fail.

- URL: https://www.tooljig.com/blog/how-to-check-color-contrast
- Category: Design
- Published: 2026-11-23

Low contrast is one of the most common accessibility problems on the web, and one of the easiest to fix once you measure it. Light gray body text, white text on a bright brand color and faint input borders all look fine on a good monitor in a dim room, and become hard or impossible to read for people with low vision, on a phone in sunlight, or on a cheap screen. The Web Content Accessibility Guidelines (WCAG) turn "readable" into a number you can check. This guide explains that number, the thresholds you need to meet and how to adjust a color that fails.

> Tool: [Color Contrast Checker](https://www.tooljig.com/color-contrast-checker): Check the WCAG 2 contrast ratio between text and background colors, see AA and AAA pass or fail, and get the nearest text color that passes AA.

## Step by step

1. Open the [color contrast checker](https://www.tooljig.com/color-contrast-checker).
2. Enter the **Text color** and the **Background color** as HEX (`#767676`), `rgb()` or `hsl()`, or use the pickers.
3. Read the contrast ratio and the pass or fail results for AA and AAA at normal and large text sizes, and for UI components and graphics.
4. Check the live preview, which shows real text in your two colors.
5. If AA normal text fails, the checker suggests the nearest lighter and darker shade of your text color that reaches 4.5:1, keeping its hue and saturation. Apply one, or swap the two colors to compare.
6. Copy the passing color into your stylesheet. If you need it in another format, the [color converter](https://www.tooljig.com/color-converter) translates between HEX, RGB and HSL.

## What the contrast ratio measures

WCAG 2 defines contrast as a ratio between the relative luminance of the lighter color and the darker one:

```text
contrast ratio = (L1 + 0.05) / (L2 + 0.05)
```

Here L1 is the relative luminance of the lighter color and L2 of the darker. Relative luminance is a weighted sum of the red, green and blue channels after converting them from sRGB to linear light, with green weighted most heavily because the eye is most sensitive to it. The result runs from 1:1 (two identical colors) to 21:1 (black on white).

Two consequences are worth knowing. The ratio is symmetrical, so dark text on a light background and the same colors reversed give the same number. And hue barely matters on its own: pure red `#ff0000` and mid green `#008000` look completely different, yet their luminance is so similar that the ratio between them is only about 1.3:1.

## The thresholds

WCAG 2.1 and 2.2 set these minimums:

| Content | Level AA | Level AAA |
| --- | --- | --- |
| Normal text | 4.5:1 | 7:1 |
| Large text | 3:1 | 4.5:1 |
| UI components and meaningful graphics | 3:1 | not defined |

**Large text** means at least 18 point, or 14 point bold. In CSS pixels that is about 24px regular or 18.66px bold. Headings are often large enough for the 3:1 threshold; body text and captions usually are not.

**UI components** (success criterion 1.4.11, Non-text Contrast) covers the visual boundaries and states that let someone identify and operate a control: the border of a text input, the outline of a checkbox, a focus indicator, and icons that convey meaning without a text label. These need 3:1 against the colors next to them.

AA is the level most laws, procurement rules and audits refer to. AAA is stricter and not usually required for a whole site, but 7:1 is a good target for long-form reading.

A few rules about measuring:

- The thresholds are minimums and are not rounded. `#777777` on white is 4.48:1, which fails AA, even though it might be displayed as 4.5. The lightest gray that passes on white is `#767676`, at 4.54:1.
- Disabled controls, purely decorative images and logotypes are exempt from the contrast requirements.
- Placeholder text is text, so it needs 4.5:1 too. Many default placeholder styles fail.

## Worked examples

| Text | Background | Ratio | Result |
| --- | --- | --- | --- |
| `#767676` gray | `#ffffff` white | 4.54:1 | Passes AA for all text |
| `#9ca3af` light gray | `#ffffff` white | 2.54:1 | Fails, even for large text |
| `#ffffff` white | `#3b82f6` blue | 3.68:1 | Large text and UI only |
| `#ff8800` orange | `#ffffff` white | 2.39:1 | Fails everything |
| `#000000` black | `#ff8800` orange | 8.77:1 | Passes AAA |
| `#e0e0e0` light gray | `#121212` near black | 14.19:1 | Passes AAA |

The orange rows show a common trap. Bright, saturated brand colors such as orange, yellow, light green and cyan have high luminance, so white text on them fails, while black text on them often passes comfortably.

## Fixing colors that fail

When a pair fails, change the luminance of one color while keeping its character. In practice:

1. **Darken the text on light backgrounds, or lighten it on dark ones.** This is what the checker's suggestion does. For `#ff8800` text on white it suggests `#b35f00`, a deeper orange that reaches 4.61:1. For `#9ca3af` gray it suggests `#6d7787`.
2. **Change the background instead** when the text color is fixed, for example by darkening a button from a bright blue to a deeper one behind white text.
3. **Switch the text to black or near black** on bright colored backgrounds. It is often the only option that keeps the brand color unchanged.
4. **Make the text large and bold** if a pair sits between 3:1 and 4.5:1 and you cannot change the colors. That works for headings and buttons, not for body text.
5. **Add a border or outline** to controls whose fill does not reach 3:1 against the page. The border then carries the contrast.

HSL makes these adjustments easier to reason about, because you can change lightness while keeping hue and saturation. Convert a HEX value with the [color converter](https://www.tooljig.com/color-converter), lower the lightness a few percent at a time and re-check. If you build gradients for backgrounds, check the text against the lightest part of the gradient behind it; the [CSS gradient generator](https://www.tooljig.com/css-gradient-generator) shows the stops you are using.

> **Note:** Contrast is measured on solid colors. Text over images, video or semi-transparent overlays changes contrast across its length. Add a solid or sufficiently opaque backdrop behind the text, then measure against that backdrop.

### Beyond the ratio

WCAG 2 contrast is a useful, widely accepted guide, but it is a formula. It does not account for font weight, so thin or light fonts can be hard to read even at 4.5:1, and it is known to overstate the contrast of some dark color pairs. APCA, a newer method proposed for a future WCAG 3, models this better, but it is still a draft and not what current regulations reference. Meet the WCAG 2 thresholds, then use your eyes and, ideally, feedback from people who rely on good contrast.

## FAQ

### What contrast ratio do I need for WCAG AA?

4.5:1 for normal text, and 3:1 for large text (at least 24px, or 18.66px bold) and for user-interface components and meaningful graphics.

### Does the contrast rule apply to buttons and form fields?

Yes. The button label must meet the text threshold against the button's fill. The control's visible boundary, such as an input border or the edge of a button that has no other boundary, needs 3:1 against the surrounding colors. Focus indicators need 3:1 as well.

### Do logos and disabled buttons need to pass?

No. WCAG exempts logotypes, purely decorative elements and inactive (disabled) components. Disabled controls should still be recognisable, but they have no minimum ratio.
