WCAG 2.1 / 2.2 & APCA Color Contrast Studio Pro

Calculate WCAG 2.1/2.2 AA/AAA ratios, APCA (WCAG 3.0) scores, simulate 8 color blindness modes, auto-fix contrast in OKLCH, and test design system matrices 100% client-side.

100% Client-Side Privacy: Color math, OKLCH lightness optimization, SVG matrix filters, and mockup eyedropper execute strictly in local browser memory.
WCAG 2.2 + APCA Ready
WCAG 2.1 / 2.2 Contrast Ratio
10.82:1
EXCEEDS WCAG AAA REQUIREMENTS
AA Normal Text 4.5:1 Target PASS
AA Large Text 3.0:1 Target PASS
AAA Normal Text 7.0:1 Target PASS
WCAG 2.2 UI Non-Text 3.0:1 SC 1.4.11 PASS
APCA (WCAG 3.0 Preview) ALGORITHM 0.98G
Lc 88.4
Passes Body Text (14px/400w) & Headings
Size 300w 400w (Reg) 700w (Bold)
Interactive UI Component Preview Matrix
Font:
Weight:
Size: 16px
Spatial Presets:
Spatial Frequency Check:
16px @ 400w (Required: Lc ≥ 70 | Actual: Lc 88.4)
PASS (Body Copy)

Accessible Design Systems Masterclass

WCAG AAA • APCA Lc 88
Perceptual Contrast, Spatial Frequency & Color Vision Deficiency

Web accessibility guarantees universal usability across ambient lighting, mobile displays, and visual impairments. Under WCAG 2.2 Criterion 1.4.3, standard body copy requires a minimum 4.5:1 ratio, while APCA 0.98G calculates lightness contrast dynamically based on stroke width and spatial frequency.

"Design that accommodates diverse sensory capabilities enhances UX for 100% of all users."
$ --apca-spatial-lc: calculateAPCA(fg, bg);
Design System Palette Contrast Matrix (N × N) 6 Tokens (30 Pairs)
Upload UI Design Mockup or Screenshot Drop a PNG, JPG, or WEBP file to use the canvas eyedropper crosshair with 8× zoom loupe and extract dominant brand colors.

1Relative Luminance & The WCAG Contrast Formula

Under the Web Content Accessibility Guidelines (WCAG 2.1 / 2.2), color contrast is evaluated through Relative Luminance (L)—the relative brightness of any point in a colorspace normalized to 0.0 for absolute black and 1.0 for standard reference white. Rather than treating RGB as a linear arithmetic space, the human visual cortex processes light with non-linear power-law sensitivity.

Because computer monitors and mobile displays encode color using non-linear sRGB gamma transfer curves (γ ≈ 2.2), standard 8-bit color channels (0 – 255) must first be linearized into physical radiometric intensity values before optical calculation:

// Step 1: Linearize 8-bit sRGB channel (sRGB Transfer Function IEC 61966-2-1)
function sRGBtoLin(color8bit) {
    const v = color8bit / 255;
    return v <= 0.04045 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4);
}

// Step 2: Compute Photometric Relative Luminance (ITU-R BT.709 Standard)
const R_lin = sRGBtoLin(R);
const G_lin = sRGBtoLin(G);
const B_lin = sRGBtoLin(B);
const L = 0.2126 * R_lin + 0.7152 * G_lin + 0.0722 * B_lin;

Notice the dominant photometric coefficient assigned to green (0.7152), followed by red (0.2126), and blue (0.0722). Human cone photoreceptors (specifically L-cones and M-cones in the fovea centralis) peak in spectral sensitivity around 555nm (the yellow-green band). Consequently, pure lime green (#00FF00, L = 0.7152) yields almost 10× more perceived luminance than pure navy blue (#0000FF, L = 0.0722).

The Standard WCAG 2.1 / 2.2 Contrast Ratio Formula
Contrast Ratio = (L1 + 0.05) / (L2 + 0.05)
Where L1 is the relative luminance of the lighter color and L2 is the relative luminance of the darker color. The constant +0.05 offset simulates ambient veiling glare, surface monitor reflections, and lens scatter within the human eyeball. Ratios range from 1.0:1 (identical colors) to 21.0:1 (pure #000000 on #FFFFFF).

2WCAG 2.1 & 2.2 Compliance Requirements

The World Wide Web Consortium (W3C) establishes definitive normative contrast minimums categorized into two compliance tiers (Level AA and Level AAA), based on typographic scale, font stroke weight, and functional role:

WCAG Level & Criterion Element Type & Usage Typographic Dimension Minimum Ratio
Level AA (SC 1.4.3) Regular Body Copy, Table Cells, Captions < 18pt (24px) regular, or < 14pt (18.66px) bold 4.5:1
Level AA (SC 1.4.3) Large Headings, Hero Typography, Banners ≥ 18pt (24px) regular, or ≥ 14pt (18.66px) bold 3.0:1
Level AAA (SC 1.4.6) Enhanced Contrast Body Copy < 18pt (24px) regular 7.0:1
Level AAA (SC 1.4.6) Enhanced Contrast Large Typography ≥ 18pt (24px) regular, or ≥ 14pt bold 4.5:1
WCAG 2.1 (SC 1.4.11) UI Controls, Input Borders, Checkboxes, Icons All interactive visual boundary indicators 3.0:1
WCAG 2.2 (SC 2.4.13) Keyboard Focus Appearance & Indicators Minimum 2px perimeter enclosing component area 3.0:1

Note on Alpha Transparency Blending: When foreground or background colors contain alpha transparency (e.g. rgba(255,255,255,0.85) over a dark card), raw hex comparisons are invalid. Our studio mathematically composites semi-transparent foreground colors over the parent background surface using Porter-Duff source-over alpha blending before running photometric evaluation.

3APCA: The Perceptual Contrast Algorithm of WCAG 3.0

The Accessible Perceptual Contrast Algorithm (APCA) represents the next-generation foundation for digital accessibility guidelines (WCAG 3.0 / Silver). While the legacy 1998 WCAG 2.1 formula served the early web, modern psychophysics and vision research revealed critical mathematical shortcomings that APCA directly solves:

  • Directional Polarity Asymmetry: Human vision experiences optical spatial diffusion (irradiation). In positive polarity (dark text on white backgrounds), light bleeds inward into glyph strokes, slightly thinning letters. In negative polarity (light text on dark backgrounds), light bleeds outward, making letters appear thicker and bolder. The legacy WCAG formula produces identical ratios for reversed pairs (e.g. #333333 on #FFFFFF is 12.6:1, and #FFFFFF on #333333 is 12.6:1), whereas APCA assigns signed Lightness Contrast scores (Lc -88 vs Lc +96).
  • Spatial Frequency & Weight Integration: Legibility is not governed by color alone; it depends fundamentally on stroke thickness and visual angle. APCA establishes a matrix where a delicate 14px ultra-light (300 weight) font requires Lc ≥ 90, whereas a 36px bold (700 weight) headline achieves full readability at Lc ≥ 45.
  • Cone Contrast & Non-Linear Adaptation: APCA incorporates modern von Kries chromatic adaptation models and photoreceptor saturations, preventing false-positive pass ratings on saturated blues and false-negative failures on pastel UI elements.

4Why Legacy WCAG 2.1 Breaks in Dark Mode Interfaces

In modern dark mode UI design, developers and design system leads regularly encounter a major accessibility dilemma: high-visibility light gray (#94a3b8) or desaturated accent text against a dark charcoal background (#0f172a) is exceptionally readable and easy on human eyes, yet mathematically fails the legacy WCAG 4.5:1 barrier.

Conversely, forcing pure white text (#FFFFFF) onto pure pitch black (#000000) scores a perfect 21.0:1 in WCAG 2.1, but triggers severe halation effects, optical blur, and ocular fatigue for users with astigmatism (which affects over 33% of the world's population). APCA models human ocular glare curves, providing realistic perceptual scores that allow ergonomic muted grays in dark themes while preventing eye strain.

Dark Theme Design Recommendation: Avoid high-contrast pure black backgrounds (#000000) paired with pure white text (#FFFFFF). Instead, use dark slate surfaces (#0f172a or #121827) with off-white typography (#e2e8f0 or #f8fafc), maintaining a healthy 10:1 to 14:1 ratio that prevents chromatic fringing and visual vibration.

5Color Vision Deficiencies & The 8-Mode Simulator

Approximately 8.0% of men and 0.5% of women worldwide (over 350 million individuals) live with some form of Color Vision Deficiency (CVD). This studio incorporates mathematically calibrated 3×3 color transformation matrices developed by Machado et al. to simulate real-time visual perception across all major optical conditions:

Photometric Fact: CVD conditions like Protanopia and Deuteranopia severely distort chromatic hue discrimination, but have minimal impact on photometric rod/cone luminance contrast. This is why maintaining strict luminance contrast (≥ 4.5:1) ensures universal legibility even if the user cannot differentiate red from green.
Deuteranopia (Green-Blind, ~6% males)

M-cone photoreceptors are completely absent. Greens, yellows, and reds collapse into indistinguishable shades of khaki, tan, and olive.

Protanopia (Red-Blind, ~1% males)

L-cone photoreceptors are absent. In addition to hue confusion, long-wavelength red photons appear darkened, causing red alerts to resemble black backgrounds.

Tritanopia (Blue-Blind, <0.01%)

S-cone photoreceptors are missing. Blues and dark greens confuse into cyan; yellows appear pink or pale red. Affects men and women equally.

Achromatopsia (Monochromacy, 1 in 33,000)

Total absence of all cone functioning. The user perceives the digital world entirely in grayscale shades, relying 100% on luminance contrast.

6Non-Text Contrast (SC 1.4.11) & Focus Appearance (SC 2.4.13)

Under WCAG 2.1 Success Criterion 1.4.11 and WCAG 2.2 Criterion 2.4.13, accessibility obligations extend far beyond standard body text. Visual cues necessary for identifying interactive user interface components must maintain at least a 3.0:1 contrast ratio:

  • Form Input Boundaries: Unfocused and focused input outlines, dropdown borders, and radio buttons must maintain a 3.0:1 contrast ratio against the adjacent card or page surface. If no border exists, the background fill of the input must achieve 3:1 contrast against the surrounding canvas.
  • Keyboard Focus Appearance (WCAG 2.2 SC 2.4.13): When a user navigates via keyboard (Tab / Shift+Tab), the focus ring indicator must have a minimum thickness of 2 CSS pixels and achieve 3.0:1 contrast against both the inner button/control and the surrounding outer background.
  • Data Visualizations & Infographics: Slice boundaries in pie charts, bar graph fills, and line chart strokes representing distinct data series must have a 3.0:1 contrast separation against each other, or must incorporate distinct hatching patterns, dashed strokes, or direct data labels.
  • Standalone Functional Icons: Navigation hamburger menus, search magnifying glasses, and action icons with no accompanying text labels must strictly satisfy the 3.0:1 contrast threshold.

7The OKLCH Lightness Optimization Math

When a primary brand color fails accessibility testing, designers typically face an unwelcome trade-off: manual hex adjustments often muddy the brand identity by shifting hue or draining vibrancy. Our built-in Magic Contrast Auto-Fixer solves this by projecting the color into the OKLCH (Oklab Cylindrical) perceptual color space:

// Project RGB into OKLCH Color Space (Björn Ottosson, 2020)
// Lock Hue Angle (H) and Chroma (C), then run binary search on Lightness (L)
function autoFixContrast(fgHex, bgHex, targetRatio = 4.5) {
    const oklch = hexToOklch(fgHex);
    let low = 0.0, high = 1.0, optimalHex = fgHex;
    for (let iter = 0; iter < 20; iter++) {
        let mid = (low + high) / 2;
        let testHex = oklchToHex({ L: mid, C: oklch.C, H: oklch.H });
        let ratio = getWcagContrast(testHex, bgHex);
        if (ratio >= targetRatio) {
            optimalHex = testHex;
            high = mid; // Seek closest boundary to preserve brand character
        } else {
            low = mid;
        }
    }
    return optimalHex;
}

By locking the exact Hue angle (H) and Chroma saturation (C) and exclusively optimizing the perceptual Lightness channel (L), our engine guarantees instantaneous AA (4.5:1) or AAA (7.0:1) compliance with the absolute lowest mathematically possible ΔE00 (CIEDE2000) color difference.

8Legal Compliance: ADA Title II & European Accessibility Act 2026

Digital accessibility is no longer merely a UX best practice; in 2026, it is an enforceable legal mandate carrying severe civil and statutory liability worldwide:

Jurisdiction Statute / Regulation Mandated Standard Enforcement & Penalties
United States ADA Title II & Title III (DOJ Final Rule 2024/2026) WCAG 2.1 Level AA Federal civil lawsuits, statutory damages, consent decrees, and mandatory third-party audits. Over 4,000 digital accessibility lawsuits filed annually.
European Union European Accessibility Act (Directive 2019/882 / EN 301 549) WCAG 2.1 Level AA Mandatory enforcement across all private e-commerce, banking, SaaS, and transportation platforms operating within the 27 EU member states, with fines up to €100,000+.
United Kingdom Equality Act 2010 & Public Sector Bodies Regulations WCAG 2.1 Level AA EHRC enforcement notices, public procurement disqualifications, and compensation claims.
Canada Accessible Canada Act (ACA) & AODA (Ontario) WCAG 2.0 / 2.1 Level AA Statutory penalties up to $100,000 per day for major commercial enterprises non-compliant under AODA.

9Technical Color Accessibility Glossary

Essential scientific, photometric, and design system terms governing WCAG 2.1/2.2 and APCA contrast computation:

Relative Luminance (L)

The photometric brightness of any color channel on a 0.0 – 1.0 scale, weighted by human spectral sensitivity (green 71.52%, red 21.26%, blue 7.22%).

APCA (Lc)

Accessible Perceptual Contrast Algorithm score representing directional perceptual contrast based on spatial frequency, font weight, and background polarity.

SC 1.4.11 Non-Text

WCAG 2.1 Success Criterion mandating at least a 3.0:1 ratio for essential UI component boundaries, icons, focus indicators, and chart graphics.

SC 2.4.13 Focus Appearance

WCAG 2.2 criterion requiring keyboard focus indicators to maintain at least 3.0:1 contrast against adjacent background colors with a 2px minimum perimeter.

OKLCH Color Space

A cylindrical perceptually uniform color model that isolates Lightness (L), Chroma (C), and Hue (H) for distortion-free accessibility adjustments.

Deuteranopia

The most common form of red-green color blindness caused by complete absence of M-cone photoreceptors, affecting ~6% of males globally.

Protanopia

Red color blindness caused by missing L-cone photoreceptors, causing reds to appear dark gray or black and masking critical error notifications.

CIEDE2000 (ΔE00)

The industry-standard delta metric quantifying human perceptual difference between two colors; values under 2.0 are imperceptible to non-experts.

Contrast Polarity

The distinction between positive polarity (dark text on light background) and negative polarity (light text on dark background / dark mode).

10Design Tokens & CI/CD Integration Hub

Bridge accessibility validation directly into your automated engineering workflows and production design systems:

W3C Design Tokens Community Group (DTCG) Compliant: Export tested color combinations directly as structured JSON design tokens compatible with Style-Dictionary, Tailwind CSS v3/v4 theme configurations, or CSS Custom Properties (:root). You can also generate dynamic SVG status badges to embed live WCAG compliance verification badges directly in your repository's GitHub README.
/* Production CSS Custom Properties Example */
:root {
  --color-brand-primary: #2563eb;
  --color-brand-on-primary: #ffffff; /* Contrast Ratio: 8.2:1 (WCAG AAA Pass) */
  --color-surface-bg: #0f172a;
  --color-text-body: #e2e8f0;         /* Contrast Ratio: 13.4:1 (WCAG AAA Pass) */
  --color-text-muted: #94a3b8;        /* Contrast Ratio: 7.1:1 (WCAG AAA Pass) */
  --color-border-input: #475569;      /* Contrast Ratio: 3.2:1 (WCAG AA Non-Text Pass) */
}

FAQFrequently Asked Questions

What is the difference between WCAG 2.1, WCAG 2.2, and APCA (WCAG 3.0)?
WCAG 2.1 / 2.2 calculates contrast using a mathematical ratio of relative luminance: (L1 + 0.05) ÷ (L2 + 0.05), ranging from 1:1 to 21:1. APCA (Advanced Perceptual Contrast Algorithm) is the candidate algorithm for WCAG 3.0 that evaluates human visual perception (spatial frequency, text weight, font size, polarity, and ambient adaptation), outputting Lightness Contrast (Lc) scores from -108 to +106 for superior readability evaluation.
What are the WCAG 2.2 Level AA and Level AAA contrast requirements for text?
  • Level AA (Minimum Contrast - 1.4.3): Requires at least 4.5:1 for normal body text (< 18pt regular or < 14pt bold), and at least 3.0:1 for large text (≥ 18pt regular or ≥ 14pt bold).
  • Level AAA (Enhanced Contrast - 1.4.6): Requires at least 7.0:1 for normal text, and at least 4.5:1 for large text.
What is the WCAG 2.2 Criterion 1.4.11 Non-Text Contrast requirement?
WCAG 1.4.11 requires a minimum contrast ratio of 3.0:1 against adjacent colors for user interface components (active button borders, input field outlines, toggle switches, focus indicators) and graphical objects (infographic icons, standalone charts, diagram segments).
What APCA Lightness Contrast (Lc) score is required for body text and headlines?
  • Body Text (14px – 16px regular): Minimum Lc 75 (preferred Lc 90 for long-form reading).
  • Sub-Headlines & Content Text (18px – 24px): Minimum Lc 60.
  • Large Display Headlines (≥ 36px bold): Minimum Lc 45.
  • Non-Text UI Elements & Placeholders: Minimum Lc 30 (any element below Lc 15 is invisible).
How does the OKLCH Auto-Fix Contrast feature work?
When a color pair fails WCAG or APCA standards, clicking Auto-Fix in OKLCH adjusts the foreground or background color along the Perceptual Lightness (L) axis in OKLCH space while preserving original Hue (H) and Chroma (C). This guarantees accessibility compliance with zero color hue distortion or muddy artifacts.
What are the 8 Color Vision Deficiency (CVD) types simulated by this tool?
The tool uses Brettel/Viénot LMS physiological matrices to simulate:
  • Protanopia & Protanomaly: Red-blind / Red-weak (L-cone deficiency).
  • Deuteranopia & Deuteranomaly: Green-blind / Green-weak (M-cone deficiency - most common, affecting 8% of men).
  • Tritanopia & Tritanomaly: Blue-blind / Blue-weak (S-cone deficiency).
  • Achromatopsia & Achromatomaly: Complete / Partial monochromatic rod vision.
How do I audit an entire multi-color design system palette matrix?
Switch to the Matrix Tab. Enter up to 10 brand background and foreground colors. The studio generates a complete cross-product grid showing pass/fail badges, numerical contrast ratios, and APCA scores for every possible combination.
What is Focus Appearance (WCAG 2.2 Success Criterion 2.4.13)?
Introduced in WCAG 2.2 Level AA, Focus Appearance requires keyboard focus rings to have at least a 3.0:1 contrast ratio between the focused and unfocused states, with a minimum thickness of 2 CSS pixels or an equivalent perimeter area.
How do I export accessible color tokens to CSS, Tailwind, and Figma?
Click Export Design Tokens to generate ready-to-copy code blocks in CSS Custom Properties (:root { --color-primary: #...; }), Tailwind CSS config format, W3C Design Tokens Community Group (DTCG) JSON, and Figma Tokens Studio JSON.
Is this WCAG contrast studio fully compliant with the European Accessibility Act (EAA) and ADA Title II?
Yes. Both the US Americans with Disabilities Act (ADA Title II / Section 508) and the European Accessibility Act (EN 301 549) mandate adherence to WCAG 2.1/2.2 Level AA. This tool validates against these official legal standards.
What is the difference between OKLCH and sRGB for contrast calculation?
sRGB is notoriously non-perceptually uniform, meaning the mathematical distance between two colors does not match how humans perceive lightness. OKLCH (derived from OKLAB) models human vision accurately, meaning a lightness shift of 10% in OKLCH looks visually identical whether adjusting a dark navy or a bright yellow, making it the superior color space for automated accessibility contrast fixes.
Why do light text on dark backgrounds score differently in APCA?
Unlike the older WCAG 2.x algorithm which is symmetrical, APCA is polarity-aware. Human vision processes light-on-dark (negative polarity) differently than dark-on-light (positive polarity). Because light text on dark backgrounds suffers from perceptual halation (glow), APCA requires a slightly higher lightness contrast threshold (Lc) for dark mode designs to ensure equivalent readability.

Rate WCAG 2.1 / 2.2 & APCA Color Contrast Checker Studio

Help us improve by rating this tool.

5.0/5
335 reviews