Contrast Checker

Pick a text colour and a background. You get the WCAG 2 contrast ratio, a pass or fail for each use, and the nearest colour that would pass.

How it works

WCAG 2 measures contrast as a ratio of relative luminance, from 1:1 (the same colour twice) to 21:1 (black on white). Each colour is converted from sRGB to linear light, weighted for how the eye sees red, green and blue, and the lighter value plus 0.05 is divided by the darker value plus 0.05.

The thresholds come from three success criteria. 1.4.3 (level AA) asks for 4.5:1 for body text and 3:1 for large text. 1.4.6 (level AAA) asks for 7:1 and 4.5:1. 1.4.11 (level AA) asks for 3:1 for the parts of a control you need to see, such as an input border or an icon button.

The ratio is compared without rounding, because WCAG does not round. A pair at 4.499:1 fails 4.5:1. This page shows two decimals cut rather than rounded, so a failing pair never displays as 4.50.

The suggested colours keep your hue and saturation and move only the lightness, the least change that reaches the goal you pick. Everything is worked out on this page; no colour is sent anywhere.

How to use it

  1. 1 Pick or type the text colour. Hex, rgb(), hsl() and CSS colour names all work.
  2. 2 Pick or type the background colour.
  3. 3 Read the ratio and the pass or fail for each use in the table.
  4. 4 Choose what must pass, then press Use on a suggested text or background colour to try it.

Good to know

  • #767676 is the lightest grey that passes 4.5:1 on white. #595959 is the lightest that passes 7:1.
  • Large text means at least 24 CSS pixels (18 point) at normal weight, or about 18.7 CSS pixels (14 point) in bold.
  • Placeholder text in an input is still text. If people need to read it, it needs 4.5:1 like any other text.
  • For a see-through colour, the page measures what you actually see: the text blended over the background.

Browser support

  • Chrome 94 and later
  • Firefox 93 and later
  • Safari 16.4 and later
  • Edge 94 and later

These are the oldest versions with everything the tool uses. They are worked out from the tool itself, so they change when it does.

Version numbers checked on 2026-09-04.

Fixing a pale blue link without losing the brand

Contrast problems are easiest to see with one real pair of colours. Say a design system uses #3b82f6, a bright blue, for links on a white page. Type #3b82f6 as the text colour and #ffffff as the background, and the ratio comes out at 3.67:1. That passes large text and the 3:1 rule for icons and borders, but fails 4.5:1 for body text. A link inside a paragraph is body text, so this blue is not readable enough for everyone.

The fix does not have to be a new colour. With the goal set to body text at AA, the page suggests #1e6ff5 for the text. It is the same hue and the same saturation, a little darker, and it reaches 4.51:1. Most people would not notice the change next to the old blue, but readers with low vision or a screen in sunlight will. If the brand team wants more headroom, the AAA goal of 7:1 suggests #0950c5, a deeper blue that still reads as the same family.

The same pair can be fixed from the other side. A button with white text on a #3b82f6 background also measures 3.67:1, because the ratio does not care which colour is in front. Here the page offers two answers: make the button darker, to #1e6ff5, or make the text dark, to #1e1e1e. Both pass. Which one is right is a design choice, and having both numbers in front of you makes it a quick one. The 3:1 rule for buttons applies to the button shape against the page, which is a separate check: put the button colour and the page colour into the two fields.

Greys are where most contrast failures hide. A caption in #999999 on white looks calm and tidy, and it measures 2.84:1. The page moves it to #767676, which is the lightest grey that passes 4.5:1 on white. On a dark theme the problem runs the other way: #888888 on a navy background of #15172e already passes at 4.96:1, and the page says so instead of suggesting a change.

This checker has limits worth stating. It measures the WCAG 2 ratio between two flat colours. It cannot see a gradient or a photo behind text, where the contrast changes from one letter to the next; test the worst spot by picking its colour. It does not judge font weight or size, so you decide whether text counts as large. It does not compute APCA scores, because they are not part of the current standard. And a pass here means the colours meet the rule, not that the page is accessible: focus order, alt text and keyboard use are separate checks.

Frequently asked questions

What contrast ratio do I need to pass WCAG AA?

For body text, 4.5:1. For large text, which is 24 CSS pixels and up, or about 18.7 pixels and up in bold, 3:1. For the visible parts of buttons, inputs, focus rings and meaningful icons, 3:1 against what is next to them.

Is APCA part of WCAG?

No. APCA is a newer contrast method proposed during work on WCAG 3, which is still a draft. WCAG 2.2 is the current standard and the one laws and procurement rules point to, and it uses the ratio this page computes. APCA can be a useful second opinion, but it is not a requirement.

Why does a colour pass here but fail in another checker?

Usually because of rounding or transparency. Some checkers round 4.47 up to 4.5 and call it a pass; WCAG does not. Others ignore the alpha of a see-through colour. This page compares the unrounded ratio and blends any transparency first.

Do logos and disabled buttons need to pass?

No. WCAG exempts text that is part of a logo or brand name, and controls that are disabled. Decorative text that carries no meaning is exempt too. Everything a person needs to read or operate is not.

How is the suggested colour chosen?

It keeps the hue and saturation of your colour in HSL and moves the lightness up or down in small steps until the ratio reaches your goal. It takes whichever direction needs the smaller change. When no lightness of that colour can reach the goal, the page says so.

Related tools

Your files are processed on your device and are not uploaded. You can verify this in your browser’s developer tools under the Network tab.