Maaz Zindani

Loading the index…

↑↓ move↵ openesc close3993 pages

Free tool · Design and colour

Contrast checker

Enter a text color and a background color to get the WCAG contrast ratio and a pass or fail for AA, AAA, large text and UI components. If a pair fails, the closest passing text color appears with a Copy button.

  • Free
  • No sign-up
  • Runs in your browser

By Maaz Zindani · Updated

Normal text, 16 px. The quick brown fox jumps over the lazy dog.

Large text, 24 px

Button label UI border and icon

Contrast ratio

4.48:1#777777 on #FFFFFF: Passes only for large text and UI parts

  • 2 of 5 checks pass
  • Text luminance 0.184
  • Background luminance 1.000
CheckNeedsResult
AA, normal text
SC 1.4.3: body text
4.5:1Fail
AA, large text
SC 1.4.3: 24 px, or 18.66 px bold
3:1Pass
AAA, normal text
SC 1.4.6: body text, enhanced
7:1Fail
AAA, large text
SC 1.4.6: 24 px, or 18.66 px bold
4.5:1Fail
AA, UI components and graphics
SC 1.4.11: borders, icons, chart parts
3:1Pass
Closest passing text color
  • AA, normal text (4.5:1)#767676 gives 4.54:1
  • AAA, normal text (7:1)#595959 gives 7.00:1

Ratio = (lighter + 0.05) ÷ (darker + 0.05) from WCAG relative luminance. Suggestions keep the hue and saturation of #777777 and change only its lightness. This checks color pairs only; it does not certify a design as accessible or legally compliant.

How to use the Color Contrast Checker

  1. Type a color into Text color and another into Background color (HEX, RGB or HSL), or use the Pick swatches.
  2. Read the large ratio, then the table: every check shows its threshold and Pass or Fail.
  3. Look at the live sample under the fields to see the pair as normal text, large text and a button with a border.
  4. If a check fails, copy the color under Closest passing text color, or press Swap colors to test the pair the other way round.

What contrast ratio do WCAG AA and AAA require?

AA needs a contrast ratio of at least 4.5:1 for normal text and 3:1 for large text. AAA needs 7:1 for normal text and 4.5:1 for large text. User interface components and the parts of a graphic needed to understand it need 3:1 against the colors next to them. These thresholds come from the W3C Web Content Accessibility Guidelines 2.2: success criterion 1.4.3 (Contrast, Minimum) is AA for text, 1.4.6 (Contrast, Enhanced) is AAA for text, and 1.4.11 (Non-text Contrast) is AA for interface parts.

The ratio runs from 1:1, two identical colors, to 21:1, black on white. Every check in the table above shows the number it needs and whether the pair reaches it. A result is never rounded up across a threshold: a pair at 4.499 is shown as 4.49 and fails 4.5, because the criteria set a minimum and do not allow rounding.

Some text has no requirement. Inactive interface components, pure decoration, text nobody can see, and logotypes are exempt under 1.4.3 and 1.4.6. Other text, including images of text, is covered.

Common color pairs, checked by this tool
PairRatioAA normalAA largeAAA normalUI 3:1
Black on white21.00:1PassPassPassPass
Dark gray on white7.00:1PassPassPassPass
Gray (#767676) on white4.54:1PassPassFailPass
Gray (#777777) on white4.48:1FailPassFailPass
Blue on white8.59:1PassPassPassPass
Red on white4.00:1FailPassFailPass
White on red4.00:1FailPassFailPass
Yellow on white1.07:1FailFailFailFail

Every row is produced by the same functions that run in the checker above. Gray #767676 on white is the lightest gray that still passes AA for normal text: one step lighter, #777777, falls to 4.48:1.

How is the contrast ratio calculated?

The ratio compares the relative luminance of the two colors. Relative luminance is a brightness from 0 (black) to 1 (white). Each sRGB channel is divided by 255, then linearized: values up to 0.04045 are divided by 12.92, and larger values become ((value + 0.055) ÷ 1.055) raised to 2.4. The three results are weighted as L = 0.2126 R + 0.7152 G + 0.0722 B. Green is weighted most and blue least.

The contrast ratio is then (L1 + 0.05) ÷ (L2 + 0.05), where L1 is the lighter color's luminance and L2 the darker one's. Because the lighter color always goes on top, the order of the two colors does not change the ratio.

A worked example: #777777 has a relative luminance of 0.1845 and white has 1. The ratio is 1.05 ÷ 0.2345 = 4.48. That is below 4.5, so gray #777777 on white fails AA for normal text, yet it passes AA for large text (3:1) and for interface parts. Lightening the background would close the gap the same way, because only the luminance gap matters.

Transparent colors have no single luminance until they are laid over something. If the text color has an alpha channel, the checker flattens it over the background. If the background itself is transparent, it is checked over white, and a note under the result says so. Use the real backdrop for the true answer.

What counts as large text, and do buttons and icons need 3:1?

WCAG defines large-scale text as at least 18 point, or at least 14 point bold. Points convert to CSS pixels at 96 pixels per inch, so 18 point is 24 px and 14 point bold is about 18.66 px. Text at or above that size only needs 3:1 for AA and 4.5:1 for AAA. The sample under the fields shows text at 16 px and 24 px so the difference is visible.

Non-text contrast applies to the visual information needed to identify interface components and their states, and to parts of graphics needed to understand them. Typical examples are the border of a text field, the outline of a button when the label alone does not identify it, a focus ring, a checkbox outline, and the lines in a chart. Components that are inactive, or whose look is set by the browser and not changed by the author, are excluded. A graphic whose exact look is essential to its meaning is excluded as well.

The 3:1 rule is measured against the color directly next to the part, not against the page. A light gray input border on a white card needs 3:1 against the white, not against anything behind the card.

How do I fix low contrast and keep my brand color?

Change the lightness first and keep the hue. The checker searches the lightness of your text color in steps of 0.1 percent, keeping hue and saturation, and returns the smallest change that reaches 4.5:1 and the smallest that reaches 7:1. For the default pair, #777777 on white, the closest AA color is #767676 at 4.54:1, and the closest AAA color is #595959 at 7.00:1.

Brand colors usually need a larger move. An orange such as #FF5733 on white is 3.15:1. The closest AA text color of the same hue is #E52800 at 4.53:1, and the AAA one is #AE1F00 at 7.01:1. A mid blue such as #3B82F6 is 3.68:1 on white and needs #1E6FF5 for AA. Where a brand color fails as text, a common fix is to keep it for large shapes and use the darker variant for small text.

The fix can go the other way. White text on #FF5733 is also 3.15:1, and the closest passing text color is a dark gray, #2A2A2A, so the pair flips. If you want to keep white text, darken the background with the tint and shade generator and test again. When no lightness of the hue reaches 7:1, which happens on mid-tone backgrounds, the tool says so instead of guessing.

This tool checks color pairs. It does not judge font weight, anti-aliasing, text over photos or gradients, or whether a page as a whole meets WCAG, and it does not replace a review by a person. To read colors in other notations first, use the hex to RGB converter.

Use it with

Questions

What is a good contrast ratio for text?

At least 4.5:1 for normal text meets WCAG AA, and 7:1 meets AAA. Large text needs 3:1 for AA and 4.5:1 for AAA. Black on white is the maximum, 21:1.

What contrast do WCAG AA and AAA require?

AA: 4.5:1 for normal text, 3:1 for large text and 3:1 for interface components. AAA: 7:1 for normal text and 4.5:1 for large text. These are the minimums in success criteria 1.4.3, 1.4.6 and 1.4.11 of WCAG 2.2.

What counts as large text in WCAG?

At least 18 point, or 14 point bold. At 96 pixels per inch that is 24 px, or about 18.66 px in bold.

Does #777777 on white pass?

Not for normal text: the ratio is 4.48:1, under the 4.5:1 AA minimum. It passes AA for large text and for interface components. #767676 is the lightest gray that passes AA on white, at 4.54:1.

Does contrast apply to buttons, icons and borders?

Yes. The parts needed to identify an interface component or to understand a graphic need 3:1 against the color next to them. Text inside a button follows the text thresholds.

Is anything I type sent to a server?

No. The ratio and the suggestions are worked out in your browser and nothing you enter leaves your device.

How this page was made: the tool's results are computed in your browser by the code on this page, using the sources listed above; the explanations were drafted with AI help and checked against the tool's own output.