Color contrast matrix

Enter up to 12 colors, one per line. The table shows the contrast ratio of each color as text on each other color as background, graded for WCAG 2.

HEX, rgb(), hsl() or CSS color names; 2 to 12 colors.

5 of 15 color pairs reach 4.5:1 (AA for normal text).

Text \ Background#ffffff#f5f5f5#1a1a1a#0b5fff#777777#d93025
#ffffff1.00Fail1.09Fail17.40AAA5.12AA4.47Large only4.77AA
#f5f5f51.09Fail1.00Fail15.96AAA4.70AA4.10Large only4.37Large only
#1a1a1a17.40AAA15.96AAA1.00Fail3.39Large only3.88Large only3.64Large only
#0b5fff5.12AA4.70AA3.39Large only1.00Fail1.14Fail1.07Fail
#7777774.47Large only4.10Large only3.88Large only1.14Fail1.00Fail1.06Fail
#d930254.77AA4.37Large only3.64Large only1.07Fail1.06Fail1.00Fail

Rows are text colors, columns are backgrounds. AAA is 7:1 or more, AA is 4.5:1, Large only is 3:1 (large text and interface parts), anything lower fails.

Runs in your browser: nothing you enter is sent anywhere.

How to use it

  1. Put one color per line (commas also work). Use between 2 and 12 colors.
  2. Read the table. Rows are the text color and columns are the background.
  3. Each cell shows the pair as “Aa”, the ratio and the grade.

The formula

ratio = (L1 + 0.05) / (L2 + 0.05), where L1 is the lighter luminance. Black on white is 21:1; identical colors are 1:1. The summary line counts each unordered pair once.

Grade Ratio
AAA 7:1 or more
AA 4.5:1 or more
Large only 3:1 or more
Fail below 3:1

Example

Black, white and #777777: black on white is 21:1, black on grey is 4.69:1, and white on grey is 4.48:1. The last one misses AA for normal text by a hair.

Tips

  • Use the matrix to decide which colors of a palette may be text on which backgrounds before building components.
  • Diagonal cells are always 1:1 and can be ignored.
  • For a single detailed check with a live preview, use the contrast checker.

Frequently asked questions

How is the ratio calculated?

Each color gets a relative luminance from its linearised sRGB channels (0.2126 R + 0.7152 G + 0.0722 B). The ratio is (lighter + 0.05) divided by (darker + 0.05), from 1:1 to 21:1.

Why is the matrix symmetric in numbers?

The WCAG 2 ratio does not care which color is the text, so row A on column B equals row B on column A. The preview "Aa" shows the actual pair, which helps you judge it by eye.

What do the grades mean?

AAA needs 7:1, AA needs 4.5:1 for normal text, and 3:1 is enough for large text and for interface parts such as icons and borders. The grades use the exact ratio, never the rounded one.

Is a passing ratio enough for accessibility?

No. WCAG 2 contrast is a minimum for text legibility. It does not cover colour-blind users or thin fonts, so do not rely on colour alone to convey meaning.

Can I enter colors other than HEX?

Yes: rgb(), hsl(), oklch(), CSS color names and 3 or 6 digit HEX. Separate colors with new lines or commas.

More in Color

All tools in this category: Color ·Updated November 3, 2026

Privacy choices

Google Analytics shows us which tools are used and whether they work. It may set cookies. Your choice is kept in this browser.