Skip to content

WCAG 2.2 and APCA color contrast checker

Measure WCAG 2.2 ratios and APCA perceptual Lc side by side, complete with OKLab-closest AA/AAA shade fixes.

FG HSL:
FG OKLCH:
BG OKLCH:

WCAG 2.2 contrast ratio

14.63:1

Normal AA Pass (>=4.5) Normal AAA Pass (>=7.0) Large / UI AA Pass (>=3.0)

APCA perceptual score

Lc 101.4

Lc 90+ (Preferred body)

Polarity: Dark text on light surface

Large heading preview (20px bold)

Body copy preview at 16px: the quick brown fox checks contrast polarity across real paragraphs, links, and form inputs.

UI button border (>= 3:1)
Deuteranopia 14.88:1
Protanopia 14.34:1
Tritanopia 14.52:1
Achromatopsia 14.55:1

Your files are open only in this tab. Nothing is uploaded.

How to use WCAG contrast checker

  1. Enter foreground and background colors. Pick swatches, paste HEX, RGB, RGBA, HSL, or OKLCH strings into Foreground (text / icon) and Background, or click a preset like White on indigo.
  2. Sample from an existing layout if needed. Click Sample from screenshot, upload an image, switch between Set FG and Set BG, and click pixels on the preview canvas.
  3. Review WCAG 2.2 and APCA scores. Inspect Normal AA, Normal AAA, and Large / UI AA badges alongside the signed APCA Lc value and four color blindness cards.
  4. Apply shade fixes and copy tokens. Click Apply AA foreground, Apply AAA foreground, or Apply AA background to adjust hues in OKLab, then select Copy CSS variables.

Your files are processed on this device and never uploaded. They stay private, and there's nothing to delete afterwards.

How do WCAG 2.2 ratios differ from APCA perceptual contrast?

WCAG 2.2 scores any foreground and background pair symmetrically between 1.00:1 and 21.00:1 from linear sRGB luminance. By contrast, this WCAG and APCA contrast calculator computes a signed perceptual Lc value (-108 to +106) factoring in polarity, soft black clamping, and font-weight contrast sensitivity.

Relative luminance math behind 4.5:1 and 7.0:1 ratios

Under W3C Understanding WCAG 2.2 Contrast (Minimum), sRGB channels convert to linear light around the 0.04045 cutoff (c / 12.92 below, ((c + 0.055) / 1.055)^2.4 above). Relative luminance sums those components as 0.2126 * R + 0.7152 * G + 0.0722 * B.

Dividing (L_lighter + 0.05) by (L_darker + 0.05) outputs WCAG 2.2 contrast ratio. Normal copy passes Normal AA at 4.50:1 and Normal AAA at 7.00:1, while 18 pt (24 px) or 14 pt (18.67 px) bold passes Large / UI AA at 3.00:1.

Why APCA Lc accounts for polarity and font weight

Dark-mode interfaces expose a blind spot in symmetric ratios: light text on deep blue often passes WCAG 4.5:1 yet reads faintly compared with dark text on white. APCA applies a 2.4 channel curve, clamps black below 0.022, and uses asymmetric polarity exponents (0.56/0.57 vs 0.65/0.62).

Positive APCA perceptual score outputs denote Dark text on light surface, whereas negative outputs signal Light text on dark surface. Clicking Swap colors flips polarity immediately to expose that asymmetry.

Four simulated cards below the typography specimen preview shifts across Protanopia, Deuteranopia, Tritanopia, and Achromatopsia. To inspect entire dashboards rather than isolated tokens, test UI screenshots for color blindness across complete menus and charts.

WCAG 2.2 levels and APCA Lc targets compared

Legal audits in the United States and Europe enforce WCAG 2.2 ratios directly, while APCA guides typographic hierarchy during design reviews. Matching both metrics prevents readable body text from failing statutory checks or passing mathematically while still straining eyes.

Typography or UI element WCAG 2.2 AA WCAG 2.2 AAA APCA Lc tier Typical CSS context
Preferred body copy >= 4.50:1 >= 7.00:1 Lc 90+ (Preferred body) Long-form articles, 14–16 px regular text
Minimum body paragraph >= 4.50:1 >= 7.00:1 Lc 75+ (Body copy) Standard product UI copy and labels
Fluent sub-text >= 4.50:1 >= 7.00:1 Lc 60+ (Readable content) Bold captions, secondary metadata
Large headings >= 3.00:1 >= 4.50:1 Lc 45+ (Large / bold) 20px bold titles, display headlines
Spot and placeholders >= 4.50:1 N/A Lc 30+ (Spot / placeholder) Disabled states, secondary hints
UI borders and focus rings >= 3.00:1 N/A Lc 15+ (Non-text / border) Input outlines, button frames, active icons

Note how WCAG 2.2 evaluates single contrast pairs rather than font weight lookup tables, whereas the APCA-W3 Accessible Perceptual Contrast Algorithm ties absolute |Lc| directly to font weight and pixel height. For document workflows beyond CSS tokens, run our PDF accessibility checker to audit structure tags and reading order alongside color contrast.

Fixing failing shades in OKLab with alpha compositing

When Failing muted (#94a3b8 on #ffffff, around 2.56:1) fails AA, adjusting lightness in HSL shifts perceived brightness unevenly across hues. This OKLab contrast checker adjusts perceptual lightness instead, keeping brand hues consistent while reaching accessible targets.

Whenever contrast falls below 4.5:1 or 7.0:1, Closest OKLab accessible shade fixes offers Apply AA foreground, Apply AAA foreground, and Apply AA background buttons. Each fix runs a 24-iteration binary search toward L = 0 and L = 1, scaling chroma smoothly (1 - mid * 0.65) near gamut edges.

Because the search tests darker and lighter targets simultaneously, it selects whichever adjustment has smaller OKLab lightness distance |ΔL| from your starting shade. One click updates the active field and refreshes every contrast badge.

Evaluating rgba() transparency and modern OKLCH inputs

Compliant with the W3C CSS Color Module Level 4 Specification, Foreground (text / icon) and Background parse #rgb, #rgba, #rrggbb, #rrggbbaa, rgb(), rgba(), hsl(), hsla(), hwb(), oklch(), and oklab(). Angle suffixes accept deg, turn, rad, and grad.

  • Translucent foregrounds: Alpha values below 1 blend directly over the resolved opaque background before computing luminance, so rgba(30, 41, 59, 0.55) reports its rendered contrast.
  • Translucent backgrounds: Semi-transparent backgrounds composite over #ffffff first before evaluating the foreground pair.

After tuning link and body colors for digital books, validate packaging files alongside CSS styling. Verify accessible ebook compliance before EU launch to catch missing EAA metadata and broken XHTML anchors.

Sampling live screenshots and exporting CSS color tokens

Hardcoded stylesheet variables often differ from real pixels after CSS opacity layers, gradients, or backdrop filters render in production. Sampling pixels directly from a browser screenshot catches hidden contrast regressions on cards, badges, and buttons.

Picking pixel colors with Set FG and Set BG

Click Sample from screenshot to draw a local image onto a scaled preview canvas (up to 520 px wide) strictly inside browser memory. Toggle Set FG or Set BG above the canvas, then click any text glyph, border, or surface pixel to read its exact getImageData RGB triplet into the active field.

Testing UI borders and exporting CSS variables

Under W3C Understanding WCAG 2.2 Non-text Contrast, interactive controls such as UI button border (>= 3:1) require at least 3.00:1 contrast against adjacent backgrounds so keyboard focus outlines and form fields stay visible. Confirm the specimen preview card clears Large / UI AA before shipping custom outline tokens.

Once your pair passes, select Copy CSS variables in the top toolbar to export accessible CSS custom properties (--color-fg, --color-bg, and calculated --color-fg-aa or --color-fg-aaa fallbacks) cleanly. If you also distribute technical manuals for low-glare reading, pair dark-theme UI styling with a dark-mode PDF color inversion workflow for printed handouts.

Tip: Check FG OKLCH and BG OKLCH after applying an AA or AAA shade fix so you can store matching --color-fg-aa tokens across light and dark themes with consistent perceptual chroma.

Questions

Why show both WCAG 2.2 ratio and APCA Lc?

WCAG 2.2 (referenced by ADA Title II, Section 508, and EN 301 549) calculates a relative luminance ratio from 1:1 to 21:1, while APCA models light-on-dark polarity and font weight perception via a signed Lc score.

How do the accessible shade suggestions work?

When contrast falls below 4.5:1 (AA) or 7.0:1 (AAA), a 24-step binary search adjusts lightness inside perceptual OKLab space rather than naive RGB so your brand hue stays visually faithful across light and dark themes.

Does alpha transparency work accurately?

Yes. Semi-transparent foreground colors such as rgba() or 8-digit hex values composite over the resolved opaque background before calculating both WCAG contrast and APCA Lc, while translucent backgrounds composite over pure white first.

What counts as large text under WCAG 2.2 contrast rules?

WCAG 2.2 classifies text as large when rendered at 18 pt (24 px) or larger in regular weight, or 14 pt (18.67 px) or larger in bold weight. Large text requires 3.0:1 for AA and 4.5:1 for AAA.

Can I test colors under Protanopia and Deuteranopia here?

Yes. Four simulation cards below the live typography specimen apply Viénot and Brettel linear-RGB cone matrices for Protanopia, Deuteranopia, Tritanopia, and Achromatopsia, displaying each simulated hex pair and contrast ratio.

Why do dark-mode gold and white-on-indigo presets differ in APCA polarity?

Dark-mode gold (#facc15 on #0f172a) renders light text on a dark surface, returning a negative APCA Lc score. White-on-indigo also reports negative polarity, whereas Slate on white returns a positive dark-on-light score.

Updated