Skip to content
Pandus

Color contrast checker (WCAG 2.2 AA and AAA)

Enter a text colour and a background colour: the checker shows the contrast ratio by the WCAG 2.x formula, whether it passes level AA and AAA for normal and large text and for interface parts, and the closest text colour that reaches 4.5:1.

Contrast checker

Hex (#2f47d9, #fff, #2f47d980), rgb() and rgba(), hsl() and hsla(), or a colour name such as navy.

Show the sample as
No red-sensitive cones: red and green look alike, red looks darker. No green-sensitive cones: the most common type, red and green look alike. No blue-sensitive cones: blue and green, yellow and pink look alike. No colour vision: only lightness is seen.

Normal text: add the product to your cart and pay in three steps.

Large text: €129

Button border and icon

4.54 : 1

Contrast ratio

  • Normal text, level AA 4.5 : 1 · WCAG 1.4.3 —
  • Large text, level AA 3 : 1 · WCAG 1.4.3 —
  • Icons, field borders and other interface parts 3 : 1 · WCAG 1.4.11 —
  • Normal text, level AAA 7 : 1 · WCAG 1.4.6 —
  • Large text, level AAA 4.5 : 1 · WCAG 1.4.6 —

Large text means at least 24 px, or 18.66 px in bold. The check runs in your browser; the colours are not sent anywhere.

Pick colours from an image

The image stays in your browser: it is drawn on this page and never uploaded.

How the ratio is calculated: luminance formula and transparency
Relative luminance of the text
0.1812
Relative luminance of the background
1.0000

Each sRGB channel (0–255) is divided by 255 and linearised: c ≤ 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055)^2.4. The relative luminance is then:

L = 0.2126 × R + 0.7152 × G + 0.0722 × B

The contrast ratio is (L1 + 0.05) / (L2 + 0.05), where L1 is the lighter colour. It runs from 1 : 1 to 21 : 1 and is cut, not rounded, to two decimals.

Transparency: a semi-transparent text colour is first blended with the background (alpha compositing: alpha × text + (1 − alpha) × background), and the ratio is measured on the colour you actually see. A semi-transparent background is blended with white.

The colour vision previews are an approximation (Machado et al., 2009). Real vision varies from person to person; WCAG measures contrast on the original colours.

What the results mean

Requirement Minimum WCAG criterion
Normal text, level AA 4.5 : 1 1.4.3 Contrast (Minimum)
Large text, level AA 3 : 1 1.4.3 Contrast (Minimum)
Normal text, level AAA 7 : 1 1.4.6 Contrast (Enhanced)
Large text, level AAA 4.5 : 1 1.4.6 Contrast (Enhanced)
Icons, borders, interface parts 3 : 1 1.4.11 Non-text Contrast

Level AA is the level that EN 301 549, the European Accessibility Act, the German BFSG and US practice under the ADA rely on. AAA is stricter and not required by these laws.

WCAG contrast requirements in detail

Text: 1.4.3 Contrast (Minimum), level AA. Text and images of text need a contrast ratio of at least 4.5:1 against their background; large text — at least 24 CSS pixels, or about 18.66 pixels in bold — needs 3:1. Logos, text of disabled controls and purely decorative text are exempt. Placeholder text, prices, sale badges and text on banners are not. Details: 1.4.3 Contrast (Minimum).

Non-text contrast: 1.4.11, level AA. The parts of the interface people need to see to use it need at least 3:1 against what is next to them: the border of an input field, the outline of a checkbox or radio button, the focus indicator, icon-only buttons, the state of a toggle, and lines and segments in charts that carry information. A light grey input border on white is the most common failure. Details: 1.4.11 Non-text Contrast.

AAA contrast: 1.4.6 Contrast (Enhanced). Level AAA raises the text values to 7:1 and 4.5:1 for large text. No law we know of requires AAA for whole sites, and the W3C does not recommend it as a general policy, but 7:1 for body text helps older readers and anyone on a phone in sunlight. More on the levels: WCAG levels A, AA and AAA.

To test a non-text pair, enter the colour of the border or icon as the text colour and the background behind it as the background colour, and read the "interface parts" row.

Can I check an image or a screenshot?

Yes. Under the colour fields, choose an image, drop a screenshot or paste it with Ctrl+V (⌘V on a Mac), then click the text and then the background in it — or move the crosshair with the arrow keys and press Enter. The image is drawn on this page in your browser and is never uploaded.

  • Text edges are smoothed (anti-aliasing), so pick a pixel in the middle of a thick letter, not at its edge.
  • For text on a photo or a gradient, check the lightest and the darkest area behind the text separately.
  • On a live page, the browser extension takes the text colour and the real background of an element you click, including semi-transparent layers.

To find every low-contrast text on a page at once, run the free WCAG checker: it reports each element with its colours and ratio.

Colours with transparency, and colour blindness

The fields accept hex (also with alpha, like #2f47d980), rgb(), rgba(), hsl(), hsla() and colour names. A semi-transparent text colour is blended with the background first, and the ratio is measured on the colour you actually see; a semi-transparent background is blended with white.

The switch above the sample shows the colours as people with protanopia, deuteranopia, tritanopia or achromatopsia see them. It is an approximation (Machado et al., 2009) and vision varies from person to person; WCAG measures contrast on the original colours, so use it to spot pairs that rely on colour alone.

Why contrast matters in an online shop

Grey prices on white, white text on a pale banner, light placeholders in the checkout form: people with low vision, older customers and anyone on a phone in sunlight read them slowly or not at all. Low contrast is the most frequent problem automated checks find on shop websites. Fix it in the colour settings of your theme or in its CSS variables, not element by element.

How the ratio is calculated

The ratio compares the relative luminance of the lighter and the darker colour: (L1 + 0.05) / (L2 + 0.05). It goes from 1:1 (the same colour) to 21:1 (black on white). Transparency, shadows and background images change the real contrast; check text on images with the darkest and lightest part of the image behind it.

How the relative luminance is computed, why designers also talk about APCA and how Windows high contrast mode fits in: APCA vs WCAG contrast.

Check the whole site

This checker tests one colour pair. Pandus finds every text with low contrast on a page — with the colours, the ratio and a screenshot — and checks every page of your site each week. See also the rule low text contrast.

Guides and tools

Automated checks for this topic

Help articles

  • Free tools: what each one does

    A quick check of one page, an HTML checker, contrast and readability tools and a statement generator, all without an account.