Your country

Tools that support it use your country for local currency, number formats, units and paper size. Your choice is saved only in this browser.

Type a name or a two-letter code. Use the up and down arrow keys to move through the countries, Enter to choose one and Escape to close.

Color Contrast Checker (WCAG 2.2)

Test text and background colors against WCAG 2.2, then fix them in one click.

Design No upload Works offline Free, no sign-up
100%
100%

Any CSS color: HEX (with alpha), rgb(), hsl(), hwb(), oklch(), oklab() or a name such as navy.

Contrast ratio —

  • — AA · normal text needs 4.5:1 · SC 1.4.3
  • — AA · large text needs 3:1 · SC 1.4.3
  • — AAA · normal text needs 7:1 · SC 1.4.6
  • — AAA · large text needs 4.5:1 · SC 1.4.6
  • — UI components & graphics needs 3:1 · SC 1.4.11

Preview

px

The sample below shows text, a button, an input border and an icon in your two colors; the results above describe how readable they are.

Nearest passing colors

Text over an image

Open a photo, banner or screenshot to measure your text color against the area it sits on.

Next steps

About the Color Contrast Checker (WCAG 2.2)

Enter a text color and a background color in any CSS notation — HEX, rgb(), hsl(), oklch() or a name — and get the WCAG 2.2 contrast ratio with the results for normal text, large text and interface components at levels AA and AAA. A live preview shows your text at the size and weight you choose, and says whether that size counts as large text.

If a pair fails, the tool suggests the nearest colors that pass: it changes only OKLCH lightness, so the hue and colorfulness of your brand color stay recognizable. You can also check text that sits on a photo or illustration: open the image, select the area behind the text, and see the lowest contrast in that area and the pixel that causes it.

How to use it

  1. Type or pick the Text color and the Background color. Use Swap to try the reverse.
  2. Read the ratio and the AA/AAA results — Copy result puts them on the clipboard as text. Text at least 18 pt (24 px), or 14 pt (about 18.7 px) bold, counts as large.
  3. Set the font size and weight under Preview to see your real text and which requirement applies to it.
  4. Under Nearest passing colors, choose the level you need and select Use on a suggestion to apply it.
  5. For text on a picture, open the image under Text over an image, then drag across the area behind the text.

Examples

Mid gray on white
Input
Text #777777 · Background #ffffff
Result
4.47:1 — fails AA for normal text, passes for large text and UI parts
Nearest passing text color: #767676 (4.54:1)

One step darker in each channel is enough. Ratios are cut, not rounded: 4.47 stays below 4.5.

A blue button with white text
Input
Text #ffffff · Background #3b82f6
Result
3.67:1 — passes AA only for large text
Nearest passing background: #2c72e5 (4.52:1, same hue)
Semi-transparent text
Input
Text rgb(0 0 0 / 50%) · Background #ffffff
Result
Measured as #808080 on #ffffff: 3.94:1

No lightness of 50% black can reach 4.5:1 on white, so the tool says to raise the opacity instead.

Common uses

  • Checking brand colors, buttons, links and form fields before a design is built.
  • Fixing failing color pairs reported by an accessibility audit with the smallest possible change.
  • Choosing a text color for a hero image or banner photo.
  • Documenting which color combinations of a design system meet AA or AAA.

How the contrast ratio is calculated

WCAG 2.2 converts each color to its relative luminance — the linearized red, green and blue channels weighted 0.2126, 0.7152 and 0.0722 — and divides the lighter by the darker, after adding 0.05 to both. The ratio runs from 1:1 to 21:1.

  • AA (SC 1.4.3): 4.5:1 for normal text, 3:1 for large text.
  • AAA (SC 1.4.6): 7:1 for normal text, 4.5:1 for large text.
  • Non-text (SC 1.4.11): 3:1 for the visual parts of interface components (borders of inputs, focus rings) and meaningful graphics.

The thresholds are minimums: W3C’s Understanding 1.4.3 notes that values must not be rounded, so 4.499:1 does not meet 4.5:1. This tool cuts the ratio to two decimals instead of rounding it.

Transparent colors

A translucent text color is blended with the background first, exactly as the browser draws it, and the blended color is measured. A translucent background is measured on white, because WCAG assumes white when no background is specified — if your page behind it is a different color, check the color it actually appears as.

How the nearest passing color is found

The suggestion keeps the color’s OKLCH chroma and hue and searches lightness only, in both directions, for the smallest change that reaches the chosen ratio. The final color is rounded to whole RGB values and checked again, so the suggestion always passes as written. Sometimes only one direction works (white text cannot get lighter), and sometimes neither does — for example semi-transparent text that is too faint at any lightness.

Text over images

WCAG measures contrast against the background the text is shown on, and W3C’s failure technique F83 covers background images that do not give enough contrast. Because a photo is not one color, this tool measures your text color against every pixel of the area you select (images over about 4 megapixels are measured on a smaller copy, which the page tells you) and reports the worst pixel, the ratio that 95% of the area reaches, and the share of the area that passes. The worst pixel is the strict test; a few stray pixels may be acceptable if the letters remain clearly readable, but when in doubt add a solid or semi-opaque backing behind the text.

Limitations

  • The WCAG 2.x formula does not model font weight or thin strokes: a thin or decorative font can be hard to read even when it passes.
  • Text that is part of a logo, purely decorative, or in a disabled control is exempt from WCAG contrast requirements; the tool cannot know which applies to your text.
  • Gradients are not read from CSS: open a screenshot of the area as an image instead.
  • Colors are sRGB. Wide-gamut colors outside sRGB are mapped into it before measuring.

Privacy

Everything happens in your browser. What you enter or open here is not uploaded or stored by MySmartCoPilot.

Frequently asked questions

What contrast ratio do I need?

For WCAG level AA: 4.5:1 for normal text, 3:1 for large text (at least 18 pt / 24 px, or 14 pt / about 18.7 px bold) and 3:1 for interface components and graphics. For level AAA: 7:1 for normal text and 4.5:1 for large text.

Why does 4.48:1 fail when it is so close to 4.5:1?

WCAG thresholds are minimum values and are not rounded, so anything below 4.5:1 fails. That is why the ratio here is cut to two decimals rather than rounded up.

How do I fix a failing color without changing my brand?

Use Nearest passing colors. It only changes lightness, so a brand blue stays the same blue, just a little darker or lighter. Often you can keep the brand color for large headings and buttons (3:1) and use a darker shade for small text (4.5:1).

Does the checker handle transparent colors?

Yes. Semi-transparent text is blended with its background before measuring, and a semi-transparent background is measured on white, which is what WCAG assumes when no other background is given. Notes under the result say when this happened.

Is my image uploaded when I check text over an image?

No. The image is read by your browser on your device. Nothing is sent to a server, and the checker also works offline once the page has loaded.

Quick answers and tool search

Type to search tools or to get a quick answer, for example 18% of 2500. Use the up and down arrow keys to move through the results, Enter to choose, and Escape to close.