Check accessible WCAG 2.1 contrast ratios between foreground text and background in real time, preview typography live, and copy calibrated HEX, RGB, HSL, and CSS OKLCH color tokens locally in browser RAM.
Official W3C Relative Luminance & Contrast Formula (WCAG 2.1)
Accessibility audits under the EU Accessibility Act and W3C WCAG 2.1 compute perceptual legibility by first linearizing sRGB gamma curves for each 8-bit channel:
C_lin = C / 12.92 if C ≤ 0.04045 else ((C + 0.055) / 1.055)^2.4
Relative Luminance: L = 0.2126 × R_lin + 0.7152 × G_lin + 0.0722 × B_lin
Contrast Ratio: CR = (max(L1, L2) + 0.05) / (min(L1, L2) + 0.05) [range 1:1 to 21:1]
Required Minimum Thresholds in Web UI
| WCAG Level | Minimum Ratio | Covered UI Elements | Engineering Rule of Thumb |
|---|---|---|---|
| AA (Normal Text) | ≥ 4.5 : 1 | Body copy, inputs, captions (< 18pt / 14pt bold) | Legal compliance baseline across EU & US public sites |
| AA (Large Text & UI) | ≥ 3.0 : 1 | Headings ≥ 24px (or 18.66px bold), input borders & icons | Never ship faint low-contrast borders on forms |
| AAA (Normal Text) | ≥ 7.0 : 1 | Long-form technical articles & high-legibility dark UIs | Target ≥ 7:1 for developer docs and calculators |
Frequently Asked Questions
Why convert to CSS oklch() alongside HEX, RGB, and HSL?
Legacy HSL assigns wildly different perceived brightness to yellow versus blue at identical lightness (L%). Perceptually uniform oklch() keeps visual contrast predictable when building light/dark design tokens.
Which other local client-side tools pair well with this workflow?
Optimize icons and brand SVGs in memory with our Private SVG to PNG & WebP Converter, or draft documentation with our Private Markdown to HTML & SEO Word Counter.