Color contrast checker — WCAG AA/AAA
Check the contrast between a foreground color and a background color against the WCAG 2.1 success criteria — entirely in your browser. Enter two colors as hex, RGB, or HSL (or use the color pickers), and you get the contrast ratio plus pass or fail verdicts for normal text, large text, and UI components. No sign-up, no uploads.
Check contrast
Hex, rgb(), hsl(), or a color name — e.g. #336699, rgb(51, 102, 153), hsl(210, 50%, 40%), navy.
The color the text sits on — usually a page or panel background.
Contrast ratio
4.54 : 1
- Normal text (AA ≥ 4.5, AAA ≥ 7)
- AA
- Large text (AA ≥ 3, AAA ≥ 4.5)
- AAA
- UI components (≥ 3, WCAG 1.4.11)
- Pass
How it works
Three steps, all computed in this tab:
- Parse both colors. Hex, rgb()/rgba(), and hsl()/hsla() inputs (comma or modern space syntax) and common color names are converted to sRGB channels. Out-of-range values are clamped the way CSS clamps them.
- Compute relative luminance. Each channel is linearized (the WCAG sRGB formula) and weighted: L = 0.2126 R + 0.7152 G + 0.0722 B. Pure white is 1.0, pure black is 0.
- Divide for the ratio. (Lighter + 0.05) ÷ (Darker + 0.05), rounded to two decimals, then compared against the WCAG 2.1 thresholds: AA 4.5:1 / AAA 7:1 for normal text, AA 3:1 / AAA 4.5:1 for large text, and 3:1 for UI components and graphics (1.4.11).
Worked example: #767676 (a medium gray) on white has a relative luminance of about 0.18, so the ratio is (1.05) ÷ (0.18 + 0.05) ≈ 4.54:1 — it passes AA for normal text (≥ 4.5) and AAA for large text (≥ 4.5), but falls short of AAA for normal text (needs 7). A lighter gray like #999999 on white is only ≈ 2.85:1 and fails even the large-text threshold (needs 3) — the kind of pair that looks fine on a bright screen but fails an accessibility review.
When do you need a contrast checker?
- Web accessibility compliance. WCAG 2.1 AA text contrast is a requirement for most public sites and a common procurement bar. Checking pairs as you design them is far cheaper than fixing a theme afterwards.
- UI and design QA. Before a release, verify the text-on-button, text-on-panel, and placeholder-text pairs your design system actually ships — not just the ones in the style guide.
- Data visualization and charts. WCAG 1.4.11 needs 3:1 between adjacent graphical elements (lines, chart bars, icon strokes) and their background, which is easy to miss when picking a pretty palette.
- Brand colors on colored backgrounds. Marketing pages often put brand colors on tinted panels. A quick pair check tells you whether the headline still meets AA before the design goes out.
Limits
- One pair at a time: this checker evaluates a single foreground/background pair. Real pages contain text over gradients, images, and partially transparent layers — check the actual rendered pairs, not just the ideal ones.
- Contrast is not the whole story: a passing ratio does not guarantee readable text. Font size, weight, antialiasing, and the reader's vision all matter. Test with real users, including people with color vision deficiency (contrast ratio alone cannot capture hue-based confusion).
- Alpha compositing is an approximation: for translucent colors this tool composites the foreground over the background using the standard "over" operator, flattened onto white — the same approach most checker tools use, but a reasonable model rather than a rendered-pixel measurement.
- sRGB assumption: the math uses the standard sRGB color space of the web. Wide-gamut displays or heavy calibration can make the on-screen appearance differ from the calculated values.
Frequently asked questions
What is a good contrast ratio?
For web content, WCAG 2.1 defines the targets: Level AA needs 4.5:1 for normal text and 3:1 for large text (and for UI components and graphics under 1.4.11). Level AAA needs 7:1 for normal text and 4.5:1 for large text. A ratio of 21:1 (black on white) is the maximum possible. Higher is always better — these are minimums, not targets to aim exactly at.
What is the difference between WCAG AA and AAA?
AA is the common conformance level most sites and products aim for — it is the usual legal and procurement bar (for example for many public-sector and enterprise requirements). AAA is a stricter level that is harder to satisfy across an entire site, especially with large color palettes. This checker reports both so you can see how close a pair is to each level.
How is the contrast ratio calculated?
The checker converts each color to its WCAG relative luminance L using the sRGB linearization, then applies the formula (L1 + 0.05) / (L2 + 0.05), where L1 is the lighter of the two colors. The result is rounded to two decimals, exactly like the standard WCAG examples (black on white = 21:1, pure red on white = 4:1).
What counts as "large text"?
WCAG defines large text as at least 18 point (about 24 px) regular weight, or at least 14 point (about 18.66 px) bold. Large text needs less contrast (AA 3:1, AAA 4.5:1) because thicker letterforms are easier to read at the same ratio.
Does this contrast checker upload my colors?
No. This is a static page — the contrast math runs entirely in your browser tab, and the colors you enter are never sent to a server, logged, or stored.
Why does my screen show a different color than my hex value?
Screens differ: display calibration, color profiles, and ambient light all change how a color appears. The WCAG math here uses the standard sRGB color space that the web assumes, so the numbers are the ones used for compliance checks — but if your monitor is heavily calibrated, the on-screen appearance can differ from the calculation.
Related tools
- Document Hygiene — inspect and scrub metadata from documents and photos before sharing them.
- Media Optimizer — resize and compress images in your browser with exact output sizes.
- Time Coordinator — find shared meeting windows across time zones, DST-aware.
- Payload Workbench — format and convert JSON, YAML, and Base64 payloads locally.
- RAG Cleaner — clean text and HTML into deterministic Markdown and chunks, browser-local.
- Text Hygiene — inspect invisible Unicode characters and review writing patterns locally.
- Subtitle Converter — convert SRT and VTT subtitle files locally.
- Volumetric Weight Calculator — chargeable weight for courier, air, and sea shipments.
- Passphrase Generator — create strong random passphrases locally from the EFF word list.
- Bingo Card Generator — free printable bingo cards for 75-ball, 90-ball, or word games.
- CBM Calculator — estimate cubic meters for sea freight and LCL shipping.
- Date Calculator — count days and business days between dates, or add and subtract days.
Part of Local Toolworks. Last reviewed: 2026-08-17.