UI Color Contrast Grid
Paste a list of design tokens, get a WCAG matrix of every foreground-on-background pair with AA, AAA and large-text verdicts at a glance.
About this generator
A single-pair WCAG checker is useful for the first color decision in a design, and almost useless by the time you have a token palette with ten or fifteen entries. The question that actually matters once a system has settled is which foreground colors are safe on which background colors, and the only honest way to answer it is to compute every pair. That is what this grid does. Paste your design tokens — one color per line, with an optional label before the hex — and you get back a square matrix of WCAG contrast ratios, with every pair tagged AA, AAA, AA-large, or FAIL based on the text size you selected. Labels are preserved so you can read the matrix as "Danger on Surface" rather than "#DC2626 on #1E293B," which matters more than you think when you are reviewing an audit with people who do not keep hex codes in their heads. The math uses the exact WCAG 2.1 relative-luminance formula: each channel is linearised with the piecewise sRGB function, combined as 0.2126·R + 0.7152·G + 0.0722·B, and the ratio is (L₁ + 0.05) / (L₂ + 0.05) with the brighter color on top. That means the ratio for a pair is symmetric — foreground-on-background equals background-on-foreground — so the matrix is mirrored around its diagonal, which is a quick visual sanity check that nothing is corrupted. Thresholds follow the current standard: AA normal is 4.5:1, AAA normal is 7:1, large text drops those to 3:1 and 4.5:1. Flip the text-size select to see how a scale that fails for body copy might actually be fine for a page title or a prominent button label. The grid earns its place at a very specific moment in a design-system lifecycle: when you are auditing the token layer before shipping, when you are adding a new semantic color (a warning, a destructive variant, a brand sub-palette) and need to know which combinations it unlocks, and when you are reviewing a dark-mode port and want to verify that your lightness ramp survived the inversion. In every one of those cases, a single-pair checker makes you compute n² ratios by hand; the matrix just shows you. The output footer summarises how many of the n² − n meaningful pairs pass AA and AAA, which gives you a one-number quality score for the whole system — pass rates below about 40% usually point at a palette that has too many mid-lightness tokens clustered together, and nudging two or three colors by 10–15 units of L in OKLCH often fixes the chart dramatically. If you are shipping anything that will be audited for accessibility — a government service, a healthcare product, an enterprise B2B dashboard — this is the matrix you want in the design-review deck, not another cherry-picked contrast screenshot.
Use Cases
- •Audit a design-system color palette before shipping — see every token-pair contrast ratio at once.
- •Verify a dark-mode port by pasting both themes side-by-side and comparing pass rates.
- •Decide which brand accent colors are safe for small text and which are button-background-only.
- •Produce a one-page accessibility artifact for a design-review deck or a VPAT appendix.
- •Stress-test a new semantic color (warning, destructive, info) against every existing background in the system.
- •Teach a new team member which pairings in your token layer are already decided and which they must not use.
FAQ
How many colors can I paste?
The grid caps at 14 tokens — anything larger produces a matrix that is unreadable in most browsers and in copy-paste. If your system is bigger than that, run two or three grids split by role (text/surface, accent, brand) and audit each group separately.
What do AA, AAA, AA-L and FAIL mean?
AA passes WCAG 2.1 AA at your selected text size. AAA passes the stricter AAA threshold (7:1 normal, 4.5:1 large). AA-L passes only for large text (18pt / 14pt bold). FAIL is below 3:1 and should not be used for any text at any size.
Why is the diagonal empty?
A color on itself has a contrast ratio of 1:1 and never carries information. The diagonal cell is marked with an em dash so you can scan the matrix without reading past the irrelevant squares.
Does the matrix handle non-text UI (icons, borders, focus rings)?
Partially. WCAG 1.4.11 requires 3:1 for UI components and graphical objects — that is the "large text / AA-L" threshold in this grid. For focus rings and important icons, treat the AA-L column as the acceptance line, not AA.
Can I paste colors in formats other than hex?
Each line must contain a hex code (3 or 6 digits, with or without the #). Labels can be anything you want on either side. If you have RGB or OKLCH tokens, convert them first with the OKLCH Color Converter and paste the hex column into this grid.
You might also like
Popular tools from other categories that share themes with this one.