Accessible colors: contrast according to WCAG

What the WCAG contrast ratio means, which values apply to text and UI components and how to fix colors that are too weak.

Light gray text on a white background looks elegant – and is barely readable for many people. This doesn’t only affect people with visual impairments: older readers, anyone with a reflective screen or anyone looking at their phone in bright sunlight also needs sufficient contrast.

The Web Content Accessibility Guidelines (WCAG) define measurable minimum values for this. This guide explains how the contrast ratio is calculated, which values apply to text and UI components and how to fix colors that are too weak without giving up your design.

What the contrast ratio means

The calculation is based on a color’s relative luminance, its perceived brightness between 0 (black) and 1 (white). The color channels are weighted differently: green looks much brighter to the human eye than blue, so green accounts for just over 70 % of the result and blue for just over 7 %. The contrast ratio is derived from the luminance of the lighter color (L1) and the darker color (L2):

contrast = (L1 + 0.05) / (L2 + 0.05)

The result ranges from 1:1 (identical colors) to 21:1 (black on white). A few examples on a white background:

Text colorContrast on #FFFFFFResult for normal text
#9999992.85:1insufficient
#7777774.48:1just short
#7676764.54:1meets AA
#5959597.00:1meets AAA

The thresholds are strict: 4.48:1 is not rounded up to 4.5:1. The Color Contrast Checker (WCAG) calculates the exact value for your color combination and shows which level it reaches. The complete formula is in the definition of relative luminance in WCAG 2.2.

The WCAG 2.2 requirements

1.4.3 Contrast (Minimum) – Level AA

  • Normal text: at least 4.5:1
  • Large text: at least 3:1

Text counts as large from 18 points (about 24 px) or from 14 points bold (about 18.66 px). Level AA is the level that laws and standards usually refer to.

1.4.6 Contrast (Enhanced) – Level AAA

  • Normal text: at least 7:1
  • Large text: at least 4.5:1

AAA is rarely required for an entire website, but it is a good target for long passages of body text.

1.4.11 Non-text Contrast – Level AA

UI components and graphics also need at least 3:1 against adjacent colors. This covers:

  • borders of input fields, checkboxes and buttons when they are the only thing that makes the component visible,
  • states such as focus, selected or “checked”,
  • icons without a text label and parts of charts that are needed to understand them.

A typical example: an input field with a #CCCCCC border on white only reaches 1.61:1. With #949494 it is 3.03:1 – the field stays subtle but is still recognizable. You can check both text and UI components of your color scheme with the Color Contrast Checker (WCAG). The W3C provides explanations with examples in Understanding 1.4.3 and Understanding 1.4.11.

Exceptions

No minimum contrast applies to logos and brand names, inactive components (such as a disabled button), purely decorative elements and text that is invisible or only incidentally part of an image. Text in graphics that conveys information, on the other hand, counts like normal text.

The legal situation

The European Accessibility Act (EAA) has applied since 28 June 2025. Each EU member state has transposed it into national law – in Germany, for example, through the Barrierefreiheitsstärkungsgesetz (BFSG). It covers certain consumer products and services, including many online shops and other e-commerce services; micro-enterprises providing services are exempt. Public sector bodies have been subject to separate rules for longer, in Germany for example the BITV 2.0 at federal level.

In practice, the European standard EN 301 549 serves as the technical benchmark, and it refers to the WCAG level AA criteria – so the contrast values above are part of it. Whether and to what extent the rules apply to your website depends on the individual case. This section is not legal advice; if in doubt, have it reviewed by an expert.

Common mistakes

  • Light gray text: secondary text, captions or dates in #999999 are a classic. Even #767676 meets AA on white.
  • Text on images: the background behind text on a photo changes constantly. Put a semi-transparent dark overlay or a gradient behind the text and check the lightest spot.
  • Placeholder text: the text in empty form fields is often very pale. If it conveys information, it needs 4.5:1 – a visible label above the field is better.
  • Links distinguished by color alone: if links in body text differ from the surrounding text only by color, people with color vision deficiencies won’t see them. Underline links, or at least ensure 3:1 against the surrounding text plus an additional cue on hover and focus.
  • Hover and focus states: every state has to meet the values on its own. A button that gets lighter on hover can drop below the threshold. The focus indicator needs 3:1 against the background.
  • Dark mode: check both color schemes separately. Pure white on a very dark background has plenty of contrast (#FFFFFF on #121212: 18.73:1) but can feel harsh to some readers; a light gray is often more comfortable. Also watch out for accent colors chosen for a light background that are too dark in dark mode.

Fixing colors without ruining the design

Usually it is enough to shift a color’s lightness while keeping its hue and saturation. The color then remains recognizable as the same brand color. An example with orange on white:

ColorContrast on whiteUse
#FF66002.94:1surfaces and decoration only
#C750004.59:1text, links, icons

Both colors have the same hue; the second one is simply darker. You can keep using the bright variant for large surfaces and the darker one for text. The Color Contrast Checker (WCAG) suggests the closest color that reaches AA or AAA, and you can apply it directly.

Other options:

  • Adjust the background instead of the foreground, for example make a button darker and keep the white text.
  • Make the text larger or bolder – from 24 px, or 18.66 px bold, 3:1 is enough.
  • Define colors as variables and set up separate, darker shades of your brand colors for text.

Plan for contrast from the start of a new project. If you already know your brand color, make sure the symbol and background of your favicon also stand out clearly from each other when you use the Favicon Generator – in a browser tab it is only a few pixels in size.

Outlook: APCA and WCAG 3

The WCAG 2 formula is simple but has weaknesses: for example, it is sometimes too strict with light text on a dark background and too lenient with dark text on mid-tones. The Advanced Perceptual Contrast Algorithm (APCA) is being discussed as an alternative. It takes font size and weight into account as well as polarity (light on dark or vice versa) and produces an “Lc” value.

WCAG 3, however, is a working draft, and according to the draft, the contrast method it will use has not yet been decided. The values of WCAG 2.x are the ones that currently apply. The Color Contrast Checker (WCAG) can additionally display the APCA value – use it as a guide, but always check against WCAG 2.2 as well.

Checklist

  • Normal text at least 4.5:1, large text (from 24 px or 18.66 px bold) at least 3:1.
  • For long texts, aim for 7:1 (AAA) where possible.
  • Borders of UI components, focus indicators, icons and chart elements at least 3:1.
  • Check every state: default, hover, focus, active – in both the light and the dark color scheme.
  • Don’t rely on color alone to identify links.
  • Back up text on images with an overlay or a gradient.
  • Darken or lighten weak colors while keeping the hue.

Tools for this topic

More guides