Skip to content
Free tools Let's talk

Free tool

Color contrast checker

Enter a text color and a background color to see their contrast ratio and whether they pass WCAG 2.2 at AA and AAA. If a pair fails, get the nearest color of the same hue that passes, and apply it in one click.

1Your colors

Type #777, #777777, rgb(119, 119, 119) or hsl(0 0% 47%). A color with transparency, like rgba(0,0,0,.6), sets the opacity below.

%

Semi-transparent text is mixed with the background before it is measured, the way the browser paints it.

3Preview

Normal text at 16 px. Most body copy on the web is this size, and it needs 4.5:1 to pass AA.

Large text at 24 px needs 3:1

Bold text at 18.66 px also counts as large

Book a call Learn more Email address

The button fill, the outlines and the icon are user interface parts: under SC 1.4.11 they need 3:1 against the color next to them, at AA. There is no AAA level for them.

Everything runs in your browser. The link in your address bar always holds the current pair, so you can send it to a developer or a client.

Beyond the tool

One color pair is easy. A whole site is where audits fail.

We audit websites against WCAG 2.2 AA, the level US, UK and EU accessibility rules point to in practice, then fix what we find.

Get an accessibility audit proposalA fixed-price proposal within one working day

The guide

Color Contrast Checker: the complete guide

4 referencesMethodology and limitsUpdated 15 October 2026

Built and maintained by the designers and marketers at DEMARCA, an award-winning design studio in Portugal.

On this page
  1. What the contrast ratio measures
  2. AA and AAA: what each level asks for
  3. Opacity and transparent colors
  4. How to fix a pair that fails
  5. Contrast and the law
  6. Methodology and limits
  7. Sources

What the contrast ratio measures

The contrast ratio compares how bright two colors look to the eye, from 1:1 (the same color twice) to 21:1 (black on white). It is the number the Web Content Accessibility Guidelines (WCAG), published by the W3C, use to decide whether text can be read by people with low vision or color vision deficiencies, and by everyone else on a phone in the sun. Hue plays almost no part: a red and a green of the same brightness have a ratio close to 1:1, however different they look. Whether you call it a color or a colour contrast checker, the test is the same one, defined in the same W3C document for the US, the UK and the EU.

The formula in plain words

Each color is turned into its relative luminance, a number from 0 (black) to 1 (white). The red, green and blue values are first converted from the screen's sRGB curve to linear light, then weighted the way the eye perceives them: green counts most (about 72%), red about 21% and blue only about 7%. That is why yellow looks so much lighter than blue at the same saturation. The ratio is then (lighter luminance + 0.05) divided by (darker luminance + 0.05). The 0.05 stands for the glare that a real screen always adds. The exact steps are in the methodology section at the end of this guide.

WCAG says the result must not be rounded up, so 4.499:1 fails a 4.5:1 test. Gray #777777 on white is the classic near miss: 4.478:1, shown here as 4.47:1, which fails AA for normal text by a hair. Its neighbor #767676 is the lightest gray that passes, at 4.54:1. Barely a step apart in the hex code, and on opposite sides of the line.

AA and AAA: what each level asks for

The contrast scale from 1:1 to 21:1 with the WCAG thresholds: 3:1 for large text and interface parts, 4.5:1 for normal text at AA, 7:1 for normal text at AAA.1:1no contrast3:1AA large text, icons4.5:1AA normal text7:1AAA normal text21:1black on white
The contrast ratio runs from 1:1 (the same color twice) to 21:1 (black on white), drawn here on a log scale. Each WCAG level is a threshold on that one line.

WCAG has three conformance levels. Level AA is the one websites are usually held to; AAA is stricter and the W3C itself does not recommend requiring it for whole sites, because some content cannot meet it. The contrast rules in WCAG 2.2 are:

WhatAAAAASuccess criterion
Normal text4.5:17:11.4.3 and 1.4.6
Large text3:14.5:11.4.3 and 1.4.6
Icons, input borders, focus indicators, chart parts3:1no AAA level1.4.11

What counts as large text

Large text is at least 18 point, which is 24 CSS pixels, at regular weight, or at least 14 point bold, which is about 18.66 CSS pixels. Most body copy, at 16 px, is normal text whatever the font. Thin and decorative fonts read smaller than their size suggests, so give them more contrast than the minimum. In the checker, switch the suggestions to Large text and they aim for 3:1 and 4.5:1 instead of 4.5:1 and 7:1.

User interface parts and graphics

Success criterion 1.4.11, Non-text Contrast, asks for 3:1 between the background and anything a person needs to see to use the page: the border of a text field, a checkbox, an icon button without a label, the focus ring, the line in a chart. The comparison is with the colors next to the part, so a gray input border on a white card is measured against the white. A button with a solid fill needs its fill to stand out from the page at 3:1, or its label to carry the meaning. There is no AAA level for these parts. To check one, enter the part's color as the text color, the color around it as the background, and switch the suggestions to UI parts.

What does not count

The contrast rules leave out a few things: logos and text that is part of a logo or brand name, text in disabled controls, purely decorative text, text nobody can see, and text inside a photo that carries other important content. Placeholder text in form fields does count, and it is one of the most common failures. Text over a photo or a gradient counts too: test it against the lightest area behind the letters for dark text, or the darkest area for light text. Pick that area's color with your design tool or a browser eyedropper and enter it here as the background.

Opacity and transparent colors

When text is semi-transparent, what people see is a mix of the text color and the background. The checker blends the two before measuring, the same way the browser paints it: each channel is the text value times the opacity plus the background value times the rest. Black text at 60% opacity on white is really a gray, #666666, with a ratio of 5.74:1. Drop it to 50% and it becomes #808080, at 3.94:1, which fails for normal text. The same blend explains why light text on a translucent overlay often fails on part of an image. The background itself is treated as solid: if it is transparent too, measure the color you actually see behind the text.

How to fix a pair that fails

The fastest fix is almost always lightness. Darken the text or lighten the background, and keep the hue so the brand still reads as the brand. The suggestions next to the result do exactly that: they move the lightness of one color in the smallest step that reaches AA or AAA, show the new pair as a swatch with its ratio, and apply it with one click. If you change your mind, Undo puts the previous pair back. If your brand color is a mid tone, such as a bright orange or a sky blue, use it for large headings, icons and fills, and keep a darker shade of it for body text and links. To see every pair in a palette at once, open the colors in the color palette generator and use its contrast grid.

Contrast and the law

Contrast is one of the most frequent failures in accessibility audits, and it is easy to check from the outside, which is why it shows up in complaints and demand letters. Laws rarely mention WCAG by name, but WCAG 2.x level AA is the benchmark most of them point to in practice.

  • United States, ADA Title III: the Americans with Disabilities Act covers businesses open to the public, and courts have applied it to websites. It sets no technical standard of its own for private businesses; settlements and guidance usually refer to WCAG AA.
  • United States, Section 508: federal agencies, and the technology they buy, must meet standards that incorporate WCAG 2.0 AA.
  • European Union, European Accessibility Act: in force since 28 June 2025 for many consumer products and services, including online shops, banking and e-books. It can reach businesses outside the EU that sell to people in the EU, and very small service businesses are exempt. The European standard for digital accessibility, EN 301 549, incorporates WCAG and is the usual reference for meeting it.
  • United Kingdom, Equality Act 2010: service providers must make reasonable adjustments for disabled people, which in practice includes websites. Public sector sites have their own regulations that refer to WCAG AA.

This is a general overview, not legal advice. Whether a law applies to your business depends on where you are, who you sell to and what you sell. A passing color pair is one check among the dozens an audit covers: headings, keyboard use, forms, alt text, focus order and more.

Methodology and limits

Relative luminance
As defined in WCAG 2.2: each sRGB channel is divided by 255, then linearized (values up to 0.04045 are divided by 12.92, higher values become ((c + 0.055) / 1.055) to the power of 2.4). Luminance is 0.2126 R + 0.7152 G + 0.0722 B, from 0 for black to 1 for white.
Contrast ratio
(L1 + 0.05) / (L2 + 0.05), where L1 is the luminance of the lighter color and L2 of the darker one. The result runs from 1:1 to 21:1.
Criteria checked
SC 1.4.3 Contrast (Minimum), level AA: 4.5:1 for normal text, 3:1 for large text. SC 1.4.6 Contrast (Enhanced), level AAA: 7:1 and 4.5:1. SC 1.4.11 Non-text Contrast, level AA: 3:1 for interface parts and meaningful graphics. Large text means at least 24 px, or 18.66 px bold.
No rounding up
Every pass or fail is decided on the full value. The ratio on screen is truncated to two decimals, never rounded, so 4.478 shows as 4.47:1 and fails 4.5:1, as the W3C asks.
Opacity
Text opacity is blended into the background (text times opacity plus background times the rest, per channel, rounded to whole 8-bit values) and the blended color is measured. The background is always treated as solid.
Suggestions
One color keeps its hue and saturation while its HSL lightness moves in 0.25% steps, darker and lighter. The first passing shade in each direction is compared with the original in CIE Lab, and the closer one is offered. If no shade of that hue passes, black or white is offered instead.
What it does not check
Gradients, background images and text over photos (measure the worst area yourself), text shadows and outlines, font weight and rendering, hover and focus states, and anything else on the page. It does not use APCA, an alternative method that early WCAG 3 drafts included and that was taken out of the drafts in 2023. WCAG 3 is still a working draft with no settled contrast method, so conformance today is measured with the WCAG 2.2 ratio above.

Sources

FAQ

Questions people ask

How do I check for color contrast?

Enter the text color and the background color as a hex code, RGB or HSL value, or pick them with the swatches. The checker calculates the contrast ratio, from 1:1 to 21:1, and shows whether the pair passes WCAG 2.2 AA and AAA for normal text, large text and interface parts. If it fails, the nearest passing colors appear right under the ratio, ready to apply.

Why does another checker say my colors pass when this one says they fail?

Usually rounding. Some tools round to one decimal, so 4.478:1 becomes 4.5:1 and looks like a pass. WCAG says the ratio must not be rounded up, so this checker decides on the full value and shows it cut to two decimals. A few older tools also skip the opacity blend, which makes semi-transparent text look better than it is.

Is red text on a white background accessible?

Pure red, #FF0000, on white is 3.99:1, so it fails AA for normal text and passes only for large text and icons. A darker red such as #C00000 reaches 6.47:1 and keeps the same feel. Red alone should also never be the only signal for an error: add a label or an icon.

My text sits on a photo or a gradient. How do I check it?

Find the part of the image or gradient behind the letters with the least contrast: the lightest area for dark text, the darkest for light text. Pick that color with an eyedropper and enter it as the background. If it fails, a solid or semi-transparent overlay behind the text is the usual fix, and the opacity slider shows how strong it needs to be.

Do logos and disabled buttons need to pass?

No. WCAG leaves out text that is part of a logo or brand name, text in disabled controls and purely decorative text. Everything else counts, including placeholder text in form fields, which is a frequent failure.

Can a colour contrast checker handle opacity?

This one does. Set the text opacity with the slider, or type a color with transparency such as rgba(0, 0, 0, 0.6) or #00000099. The text is blended with the background first, the way the browser paints it, and the ratio is measured on the color people actually see.

What colors contrast well together?

Contrast comes from lightness, not hue. Navy, charcoal or deep green on white or cream are safe choices, and so is white on a dark brand color. Two saturated colors of similar lightness rarely pass, however different they look.

More free tools

See all 52 tools

Accessibility audit

Let's make something matter.

We audit websites against WCAG 2.2 AA, the level US, UK and EU accessibility rules point to in practice, then fix what we find. Independent design and marketing studio in Portugal. Senior-led projects, transparent pricing and clearly defined deliverables for international clients.

  • A reply from a designer within one working day
  • A fixed-price proposal before any work starts
  • Senior-led work with clearly defined deliverables
  • Clients in Portugal, across Europe and further afield

Request a quote

Prefer email? hello@wearedemarca.com