Contrast grid — check every text and background pair in a palette

Paste your palette and the grid shows the WCAG contrast ratio of every colour as text on every other colour as background, graded and counted against the level you choose.

Live demo · real result from this tool
Highlight
Pairs passing 4.5:18 of 20

Rows = text colour, columns = background (AA18 = large text only)

Text \ Background#0f172a#3b82f6#f59e0b#ffffff#64748b
#0f172a—4.85 AA8.31 AAA17.85 AAA3.75 AA18
#3b82f64.85 AA—1.71 ✗3.68 AA181.29 ✗
#f59e0b8.31 AAA1.71 ✗—2.15 ✗2.22 ✗
#ffffff17.85 AAA3.68 AA182.15 ✗—4.76 AA
#64748b3.75 AA181.29 ✗2.22 ✗4.76 AA—

Visual grid

Processed on your device — nothing is uploaded.

How to use the contrast grid

  1. Paste your palette into Palette (one colour per line). HEX, rgb(), hsl() and CSS names all work.
  2. Choose what to Highlight: AA (4.5:1), AAA (7:1) or Large text (3:1).
  3. Read the count of pairs that pass, then the table: rows are text colours, columns are backgrounds.
  4. Use the visual grid to see each pair as real text; failing pairs are faded.
  5. Download the table as contrast-grid.csv to share with your team.

What it does and when to use it

Checking a palette pair by pair is slow. With five colours there are 20 text-on-background combinations; with ten there are 90. The grid works them all out at once, so you can see which colours are safe for body text, which only work for headings or icons, and which should never be paired.

Run it when you set up a design system, before you hand a palette to developers, or when an audit flags contrast problems. The result makes a useful “allowed combinations” chart for documentation. To dig into one pair with a size-aware verdict, use the WCAG checker. To fix a failing pair by adjusting lightness, the colour contrast checker suggests the nearest passing colour. If the palette also needs to survive colour-vision deficiency, run it through the colour blindness simulator.

How it works

For each pair, both colours are converted to WCAG relative luminance L, using the sRGB transfer function and the weights 0.2126, 0.7152 and 0.0722. The ratio is (L of the lighter + 0.05) ÷ (L of the darker + 0.05). Each cell is graded: AAA at 7:1 or more, AA at 4.5:1, AA18 at 3:1, and ✗ below that. Ratios are compared unrounded, so a pair at 4.499:1 never shows as AA.

Worked examples

These are the grid’s own results for the default five colours: navy #0f172a, blue #3b82f6, amber #f59e0b, white and slate #64748b.

  • AA (4.5:1): 8 of 20 pairs pass. Navy and white reach 17.85 AAA; amber on navy reaches 8.31 AAA.
  • AAA (7:1): only 4 of 20 pass, the navy–white and navy–amber pairs in both directions.
  • Large text (3:1): 12 of 20 pass.

The blue row reads: 4.85 AA on navy, 1.71 ✗ on amber, 3.68 AA18 on white and 1.29 ✗ on slate. White text on this blue is fine for a large button label but not for small text.

Limits and tips

  • Translucent colours are blended onto each background before the ratio is calculated; for real overlays, enter the solid result instead.
  • The grid ignores font size; AA18 cells still need large text in use.
  • Calculations run in your browser.

Frequently asked questions

How do I read the grid?
Each row is a text colour and each column is a background. The cell where they meet shows the contrast ratio and its grade. The diagonal is blank because a colour on itself has no contrast.
What does AA18 mean?
The pair reaches 3:1 but not 4.5:1, so it passes WCAG AA only for large text, meaning 18 point (24px) or 14 point bold. It also meets the 3:1 rule for icons and input borders.
Why is every ratio listed twice?
Contrast is symmetric, so blue text on white and white text on blue have the same ratio. The grid still shows both cells because you may use the pair either way round, and it counts both in the passing total.
Does the Highlight setting change the ratios?
No. It only changes which cells count as passing in the total and which cells are faded in the visual grid. The grade inside each cell always shows the highest level reached.
How many colours can I check?
Between 2 and 24. Beyond 24 the grid becomes hard to read, so the tool asks you to split the palette.

Sources

  1. Web Content Accessibility Guidelines (WCAG) 2.2 — 1.4.3 Contrast (Minimum) and 1.4.6 Contrast (Enhanced) — W3C, accessed 2026-10-08

Written by the ToolsRift team · Last updated

Pages are drafted with AI assistance and checked by automated tests. How we write and check pages.

Was this tool useful?

Report a problem

Start typing to search every tool.

↑ ↓ to moveEnter to openEsc to close