Check 11.07 · Semantic HTML and accessibility

Check color contrast

Measure the contrast of text, buttons and icons against the WCAG 4.5:1 and 3:1 thresholds, then fix the color palette of your theme or CMS.

Priority
Important
Difficulty
Easy
Estimated time
1 h to 1 day
Free, no account: your progress is saved in this browser.

Ask an AI to check this point on your site

Opens the assistant with a ready-made question: this check, its goal and your site URL.

For Gemini, Copilot or another assistant, copy the question. The link opens the chosen service directly: nothing goes through this site.

In short

Contrast is the difference in luminance between text (or an interface element) and its background, expressed as a ratio from 1:1 (no difference) to 21:1 (black on white). The WCAG (Web Content Accessibility Guidelines) set minimums: 4.5:1 for body text, 3:1 for large text, interface components and charts that carry information. The check consists of measuring the colors actually used, fixing those that fail in the theme's palette, and documenting them. Expected result: every text color / background pair on the site meets the threshold that applies to it.

Why it matters

Light gray text on a white background is hard to read for a visually impaired person, an older person, a visitor on mobile in full sunlight or on a low-end screen. It is the most widespread accessibility defect: WebAIM's annual analysis of one million home pages found, in February 2026, text below the WCAG thresholds on 83.9% of them. It is also one of the easiest to fix: a single color variable is often enough to fix a whole site.

For SEO, the effect is indirect. Contrast is not a ranking factor documented by Google; it affects readability, and therefore visitor behavior and conversion. Generative engines read text, not colors: poor contrast does not bother them, but important text placed as an image on a busy background becomes unreadable for everyone.

Contrast also has a regulatory side. In France, the RGAA (Référentiel général d'amélioration de l'accessibilité, the French accessibility framework) adopts the WCAG thresholds in its criteria 3.2 and 3.3, and the European Accessibility Act has applied since 28 June 2025 to many online services, including e-commerce.

What it improves

  • Readability for everyone Low vision, color blindness, aging eyesight, screens in full sunlight.
  • Compliance WCAG criteria 1.4.3 (Contrast (Minimum), level AA) and 1.4.11 (Non-text Contrast, AA), RGAA 3.2 and 3.3.
  • Conversion Buttons and links that stand out, visible form fields. A plausible effect, to be measured on your site.
  • Ranking and AI citations No direct effect.

How to check

The thresholds

Element Minimum threshold (AA) Enhanced threshold (AAA)
Body text 4.5:1 7:1
Large text: 24 px and above, or about 18.5 px bold 3:1 4.5:1
Field border, standalone icon, focus indicator, button state 3:1
Chart elements required for understanding 3:1
Logo, purely decorative text, disabled component none none

Thresholds are not rounded: 4.49:1 fails at 4.5:1. WCAG defines large text in points (18 pt, or 14 pt bold), which is about 24 px and 18.5 px in CSS.

Useful benchmarks, calculated with the WCAG formula:

Text Background Ratio Body text
#767676 #ffffff 4.54:1 passes
#777777 #ffffff 4.48:1 fails
#999999 #ffffff 2.85:1 fails
#ffffff #e63946 (bright red) 4.17:1 fails, large text only
#ffffff #c1121f (dark red) 6.22:1 passes
#ffffff #ff6600 (orange) 2.94:1 fails
#000000 #ff6600 (orange) 7.15:1 passes AAA

The tools

  • Chrome DevTools: inspect some text and click the color swatch of the color property; the “Contrast ratio” section of the color picker shows the ratio and the AA and AAA levels met, with a button that suggests a compliant color. The CSS Overview panel (Capture overview, Colors section, “Contrast issues”) lists all the failing text on the page. In inspect mode, the tooltip shows a warning next to the ratio when it is too low.
  • Lighthouse, axe DevTools and WAVE: automatic detection across the whole page.
  • WebAIM Contrast Checker: enter two colors and get the ratio and verdict instantly, free online.
  • Colour Contrast Analyser: a free application with an eyedropper, useful for text on images, mockups and PDFs.
  • Firefox: the Accessibility Inspector flags contrast issues and can simulate color vision deficiencies.

Good to know: automated tools cannot calculate the contrast of text placed on an image, a gradient or a video. Check these cases with an eyedropper, at the least favorable point.

The deliverable: the color matrix

List every pair actually used, with its ratio and the applicable threshold:

Use Text Background Ratio Threshold Status Fix
Body text #333333 #ffffff 12.63:1 4.5:1 OK
Secondary text (dates, captions) #999999 #ffffff 2.85:1 4.5:1 fails switch to #767676 (4.54:1)
Primary button #ffffff #2a9d8f 3.32:1 4.5:1 fails background #1d6b62 (6.30:1)
Field border #e0e0e0 #ffffff 1.32:1 3:1 fails #949494 (3.03:1) or darker
Link in body text #0066cc #ffffff 5.57:1 4.5:1 OK underlined as well as colored

The ratio is calculated as follows: (L1 + 0.05) / (L2 + 0.05), where L1 is the relative luminance of the lighter color and L2 that of the darker one. A spreadsheet or the tools above do it for you.

How to implement

Before you start

Fix at the source, in the theme's color variables, not element by element:

:root {
  --texte: #333333;
  --texte-secondaire: #767676;
  --fond: #ffffff;
  --accent: #1d6b62;
  --texte-sur-accent: #ffffff;
  --bordure-champ: #8a8a8a;
  --focus: #005fcc;
}

body {
  color: var(--texte);
  background: var(--fond);
}

.meta,
figcaption {
  color: var(--texte-secondaire);
}

.bouton {
  background: var(--accent);
  color: var(--texte-sur-accent);
}

input,
select,
textarea {
  border: 1px solid var(--bordure-champ);
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

::placeholder {
  color: var(--texte-secondaire);
  opacity: 1;
}

Points to watch:

  • Text on images: add a dark overlay or a background behind the text (background: rgb(0 0 0 / 0.6)), and check at the lightest point of the image.
  • Dark mode: redo the matrix; the pairs are not symmetrical.
  • States: hover, focus, visited, error and success must also meet the thresholds. The text of a disabled button is exempt, but must remain identifiable as disabled.
  • Color alone: a link in a paragraph must not be distinguished by its color alone (WCAG criterion 1.4.1); keep the underline.
  • Field placeholder text: the sample text (placeholder) is subject to the 4.5:1 threshold if it carries information.

Good to know: the APCA algorithm, often cited, is part of the preparatory work for WCAG 3, which is not a published standard. The reference thresholds remain those of WCAG 2.2.

WordPress

Versions WordPress 6.4 and later (verified up to 7.1).

  • Block theme: Appearance > Editor > Styles, Colors > Palette section: change the palette (text, background, accent) once for the whole site. A developer can set the palette in theme.json (settings.color.palette) and turn off custom colors (settings.color.custom: false) to prevent writers from choosing non-compliant pairs.
  • Block editor: when you change a block's text or background color, the editor may show a low contrast warning. Do not ignore it.
  • Classic theme: Appearance > Customize > Colors, or the child theme's stylesheet.
  • Page builders: set the kit's global colors rather than block by block.

Shopify

Versions Shopify theme editor, Online Store 2.0 themes with color schemes, November 2026.

Online Store > Themes > Customize, then Theme settings > Colors. In recent themes, colors are organized into schemes (text, background, buttons, button labels) applied section by section: check each scheme, then each section that uses it, especially banners with text on an image (overlay opacity setting in the section).

Wix

Versions Wix Editor and Wix Studio, November 2026.

Change the site's theme colors in the design settings (Site Design > Colors or an equivalent label depending on the editor) to fix every element that uses them. Text themes and button styles inherit these colors. Check strips with a background image and add an overlay if needed.

Squarespace

Versions Squarespace 7.1, November 2026.

Site Styles > Colors: the five-color palette and the color themes applied to sections determine text, buttons and backgrounds. Fix the palette, then check each color theme (light, dark, accent) used by a section.

Webflow

Versions Webflow Designer, all plans, November 2026.

Centralize colors in variables (Variables panel) and apply them to the global classes (Body, Heading, Link, Button). When you change a text color in the Style panel, check the contrast with the tool built into the color picker if available, otherwise with Chrome DevTools on the published site.

Laravel

Versions Laravel 10 to 13, Tailwind CSS 3 and 4.

Colors live in the stylesheet or the Tailwind CSS configuration. With Tailwind CSS 4 (the one used by recent starter kits), define brand colors in the @theme directive of resources/css/app.css; with Tailwind CSS 3, in theme.extend.colors in tailwind.config.js. Then check the most used combinations: for example, a common mid-gray for secondary text such as #6b7280 reaches 4.83:1 on white, whereas #9ca3af stays at 2.54:1. Add an automated check to CI (continuous integration) with axe: see integrate SEO, performance and accessibility tests into CI/CD (opens in a new tab).

Next.js

Versions Next.js 15 and 16.

Same approach: CSS variables or a Tailwind theme, then automated checks of the main pages in CI with Lighthouse CI or @axe-core/playwright. Component libraries ship default palettes that are not always compliant (secondary text, field borders): override their variables.

Common mistakes

  • Testing only the main text: dates, captions, help text, legal notices and footers are often the palest.
  • Forgetting non-text contrast: an invisible field border, a gray checkbox, a faint focus indicator.
  • Trusting the automated audit for text on images: it does not measure it.
  • Choosing the brand color for button text without checking: a bright orange or green with white text often fails.
  • Fixing by adding opacity: text at 60% opacity loses contrast; measure the color actually rendered.
  • Removing the underline from links in body text and keeping only the color.

Frequently asked questions

What is the minimum contrast for text according to WCAG?

WCAG criterion 1.4.3, at level AA, requires a ratio of at least 4.5:1 between body text and its background, and 3:1 for large text, meaning 18 points or 14 points bold, which is about 24 px and 18.5 px in CSS. Level AAA raises this to 7:1 and 4.5:1. Thresholds are not rounded: a ratio of 4.49:1 fails.

Does color contrast affect SEO?

Not directly: contrast is not a ranking factor documented by Google, and crawlers read text without taking its color into account. Its effect is indirect, through readability, time spent on the page and conversion. It also matters for legal compliance, with the RGAA in France and the European Accessibility Act, which has applied since June 2025 to many online services.

Do buttons and icons also have a contrast threshold?

Yes. WCAG criterion 1.4.11 requires a contrast of at least 3:1 for interface elements needed to identify them, such as a field border, a checkbox or a standalone icon, for focus indicators and for chart elements essential to understanding. Button text remains subject to the 4.5:1 threshold, or 3:1 if it is large.

How do I check the contrast of text placed on a photo?

Automated tools such as Lighthouse or axe cannot measure text placed on an image or a gradient. Use an eyedropper, for example Colour Contrast Analyser or the Chrome DevTools color picker, on the lightest area of the image behind the text. If the ratio is insufficient, add a dark overlay under the text or place the text on a solid background.

Updated on

Topic checklist (PDF)

And now?

In the “Semantic HTML and accessibility” topic

  1. Use header, main, nav, article and footer appropriately
  2. Use elements suited to the content
  3. Structure tables and lists with native elements
  4. Distinguish action buttons from navigation links
  5. Provide ALT text for informative images
  6. Use empty ALT for decorative images
  7. Check color contrast
  8. Test keyboard navigation
  9. Check form labels
  10. Use ARIA when necessary
  11. Check DOM reading order
  12. Avoid information available only on hover
  13. Provide text alternatives for media
  14. Check applicable WCAG guidelines
  15. Test with axe, WAVE or Lighthouse