FIRST CH TOOLS / Design / 03 CONTRAST CHECKER
WCAG Contrast Checker
Calculates the contrast ratio (WCAG 2.1) between text and background colors, with AA / AAA pass–fail results. The result is reflected in the URL so you can share it as-is (e.g. ?fg=333333&bg=ffffff).
| Criterion | Required | Result |
|---|---|---|
| AA — normal text | 4.5 : 1 | — |
| AA — large text (18pt / 14pt bold+) | 3 : 1 | — |
| AAA — normal text | 7 : 1 | — |
| AAA — large text | 4.5 : 1 | — |
| UI components & graphics (non-text) | 3 : 1 | — |
How to Use
- Pick two colorsUse the color pickers or type HEX values (e.g. #333333) for text and background.
- Read the verdictThe contrast ratio and AA/AAA results update instantly, with a live preview of the pair.
- Share itThe result is written to the URL — copy it and send it to your team.
About This Tool
The contrast ratio is computed with the relative-luminance formula from WCAG 2.1, the international web accessibility standard. Body text on a typical website should meet "AA — normal text" (4.5:1 or higher). We run this check as a standard QA item before every site delivery.
A pair can clear the ratio and still fail people: colours told apart by hue alone — red against green — are indistinguishable for a predictable share of your audience (around 8% of men of northern European descent). The color blindness simulator shows the same two colours under protanopia, deuteranopia and tritanopia, and takes them straight from here.
How the Contrast Ratio Is Calculated
This tool follows the WCAG 2.1 definition, in this order:
- Divide each of R, G and B (0–255) by 255 to get a value c between 0 and 1.
- If c ≤ 0.03928, use c ÷ 12.92; otherwise use ((c + 0.055) ÷ 1.055)2.4 (this turns the screen value back into an amount of light).
- Relative luminance L = 0.2126 × R + 0.7152 × G + 0.0722 × B (green weighs most because the eye sees green as brightest).
- With L1 as the lighter colour and L2 as the darker one, contrast ratio = (L1 + 0.05) ÷ (L2 + 0.05).
The ratio runs from 1:1 (identical colours) to 21:1 (black and white), and swapping text and background gives the same value. For example, #767676 on white (#ffffff) is 4.54:1, which is why it is often used as the lightest grey that meets AA's 4.5:1 on a white background. The verdict uses the unrounded value, so a pair shown as "4.50" still fails if it falls short of the threshold.
From AI Agents
This tool's contrast-ratio and AA/AAA verdict logic is also available as the contrast_check tool in our MCP (Model Context Protocol) server @first-ch/tools-mcp, callable directly by AI agents with no browser needed. See Using These Tools from AI Agents for setup details.
Install
claude mcp add firstch-tools -- npx -y @first-ch/tools-mcp
Example call
# example input passed to the agent contrast_check(fg="333333", bg="ffffff")
Other Tools
45Image Colour Palette ExtractorDrop a screenshot or a supplied logo and get up to 8 dominant colours. One-click copy for HEX, RGB and OKLCH, a band sized by how much of the image each colour covers, and contrast ratios against white and black text. The image never leaves your device.
22Color Converter & Alpha CalculatorShows one colour in HEX, RGB, HSL and OKLCH at once. Build rgba() / hsla() at any alpha and see the colour you actually get over a background, with contrast ratios and an 11-step lightness palette.
60Color Blindness SimulatorCharts and UIs that mark pass and fail in red and green can be unreadable with colour vision deficiency. See how a colour pair or an image looks with protanopia (P), deuteranopia (D) and tritanopia (T); colours that stop being distinguishable are flagged with the colour difference and contrast ratio. Nothing is uploaded.
- Browse category: Design
- Browse all tools