Skip to main content

CSS Design Token Contrast Matrix — Audit All fg/bg Pairs for WCAG AA / AAA

Paste CSS variables or JSON tokens, select fg/bg pairs, and flag every WCAG AA/AAA failure across your design system at once.

  • Runs locally
  • Category Color & Design
  • Best for Moving from a visual idea to reusable color values.

Paste CSS variables or JSON design tokens above, then click "Parse tokens".

What this tool does

Audit your entire design token set for WCAG contrast compliance in one paste. Drop in a CSS custom-properties block (:root { --color-primary: #3b82f6; }) or a JSON token file (flat, nested, or Style-Dictionary / Figma-Tokens format) — the tool extracts every hex color, renders a full foreground × background matrix, and grades each cell AA, AAA, AA-large, or FAIL using the WCAG 2.x relative-luminance algorithm. Pick which tokens act as foreground (text, icons, borders) and which act as background (surfaces, panels, cards) using the checkbox selectors. Click any matrix cell to open a details panel that shows a live text preview, the exact ratio to two decimal places, and — when the pair fails AA — the nearest safer foreground color that preserves your hue and saturation. Especially useful before handing a token set to engineering or before a scheduled accessibility audit. 100% client-side: nothing leaves your browser.

Tool details

Input
Text + Numbers + Structured content
The page exposes text boxes, numeric controls, file pickers, or structured inputs depending on the tool.
Output
Live result + Copy + Preview
The result area focuses on usable output, with copy, download, or preview actions when supported.
Privacy
Browser-side processing
The main tool logic does not call an external API, so inputs normally stay in the current tab.
Save / share
Shareable URL state
Key settings are encoded in the URL so another person can reopen the same setup.
Performance budget
Initial JS <= 22 KB
No WASM budget is declared, keeping the tool quick to open on mobile.
Best fit
Color & Design · Designer
Category and role tags drive related tools, internal links, and quick fit checks.

How to use

  1. 1. Input

    Paste or drop your content into the tool panel.

  2. 2. Process

    Click the button. All processing is local in your browser.

  3. 3. Copy / Download

    Copy the result or download to disk in one click.

How CSS Design Token Contrast Matrix fits into your work

Use it while choosing, checking, converting, or documenting colors for real interface work.

Color jobs

  • Moving from a visual idea to reusable color values.
  • Checking contrast and accessibility before a UI ships.
  • Keeping brand, design, and implementation color decisions aligned.

Color checks

  • Verify contrast against the actual background, not just a sample swatch.
  • Check dark and light themes separately when both exist.
  • Copy the final format your design system or codebase expects.

Good next steps

These links move the current task into a more complete workflow.

  1. 1 Color Contrast Checker Color contrast checker — WCAG 2.2 AA/AAA compliance for normal/large text, real-time grade. Open
  2. 2 Color Converter HEX ⇄ RGB ⇄ HSL ⇄ HSV ⇄ CMYK — instant 5-way conversion, live swatch — browser-only Open
  3. 3 OKLCH Color Converter OKLCH ⇄ HEX, RGB and HSL with a full sRGB → OKLab → OKLCH pipeline, live swatch and sRGB gamut warning — browser-only Open

Real-world use cases

  • A designer audits a full token set before handing it off to engineering

    You've built a 30-color design system palette and are about to hand tokens to the development team. Paste your CSS :root block, select text tokens as fg and surface tokens as bg, and the matrix immediately flags six failing pairs — including the muted label color on the card background. You fix the lightness of three tokens, re-paste, and hand engineering a set where every real-world pair is already AA compliant instead of leaving failures to be discovered in QA.

  • A developer validates dark-mode token contracts against WCAG AA

    Your design system ships both light and dark theme JSON files. You paste the dark theme tokens, select foreground text tokens vs background surface tokens, and read the matrix in one glance. Most pairs clear AAA. The secondary text on the elevated surface just hits 3.8:1 — AA-large only. You darken the token one step, copy the new hex, update the JSON file, and commit a fix before the next design review.

  • An accessibility consultant audits a client's token file for a VPAT report

    A client sends a Figma-Tokens JSON export before an accessibility audit. You paste it directly into this tool — the nested `{"value": "#hex"}` format is auto-detected — and get a matrix of every color token combination. You screenshot the failing cells (red), note which WCAG criterion each violates (AA normal, AA-large, AAA), and drop the matrix into your VPAT report as evidence. The whole analysis takes under a minute instead of checking pairs manually.

Common pitfalls

  • Selecting every token as both fg and bg creates a noisy N×N matrix where many cells (e.g., two background surfaces against each other) are semantically meaningless — pre-filter by role so text tokens go in fg and surface tokens go in bg.

  • Trusting a hex from a Figma export that uses opacity or composited layers. This tool grades flat hex-on-hex contrast; if your actual rendered color is a semi-transparent layer, the real contrast may be lower than the raw token value suggests.

  • Fixing only the direct-fail cells and ignoring AA-large (orange) cells. AA-large passes for headings 24px+ but fails for body text at 16px — a pair the matrix grades orange is only safe if you can guarantee it is never used on small text.

Privacy

Everything runs in your browser. The CSS or JSON you paste is processed entirely in client-side JavaScript and never leaves your device or hits a server. The tool does not log your token names, color values, or any input. If you share the URL (which encodes your pasted input when it is short enough to fit in 2 000 characters), the recipient can see your token values — treat the URL as shareable, not secret. For large token files the URL will not encode the full input; sharing is done by copy-pasting the file itself.

FAQ

Tool combos

Folks in your role tend to reach for these alongside this tool.

Made by Toolora · 100% client-side · Updated 2026-07-01