About Color Contrast Checker: Guide & Practical Notes
Light gray body text on white or vibrant blue text on dark slate may look crisp on a studio monitor yet become unreadable in sunlight or for visitors with low vision—and WCAG 2.x rules also apply to buttons and icons.
Computes exact WCAG 2.1/2.2 relative luminance contrast ratios (supporting 3-, 6-, and alpha-transparent 8-digit HEX values composited over white), reporting Pass/Fail status across AA Normal (4.5:1), AA Large/UI (3:1), and AAA Normal (7:1).
How to Use Color Contrast Checker Step by Step
- Select or type your Text/Foreground HEX and Background HEX.
- Check the computed Contrast Ratio (`X.XX:1`) and WCAG AA/AAA badges.
- Use Swap Colors to preview inverse dark/light pairings and read the live sample card.
Worked Example
Check `#0f172a` (deep navy slate) text on `#ffffff` white.
Inputs: Foreground = #0f172a, Background = #ffffff
Result: 17.85:1 — PASSES WCAG AA Normal, AA Large/UI, and AAA Normal
High luminance separation keeps both small 14 px copy and bold headings effortlessly legible.
WCAG Relative Luminance & Context Limits
Linearizes sRGB channels and computes `L = 0.2126 R + 0.7152 G + 0.0722 B`, returning `(L_lighter + 0.05) / (L_darker + 0.05)`. **Context note:** mathematical contrast cannot evaluate background photos, busy gradients, or ultra-thin font weights (`font-weight: 100`), so inspect real rendered screens too.
Contrast Ratio = (L1 + 0.05) / (L2 + 0.05)Common Real-World Uses
- Auditing navigation links, primary buttons, and placeholder text accessibility
- Checking dark-mode slate palettes before deploying CSS themes
- Validating UI icons and input borders against the 3:1 non-text WCAG threshold
Common Mistakes to Avoid
- Checking only headings and forgetting subtle form borders, icons, and disabled/placeholder labels (which need 3:1 for active UI components).
- Using bright cyan or yellow `#ffffff` buttons (`#38bdf8` on white is well below 4.5:1 for white button labels—use darker `#0284c7` / `#0369a1`!).
Supported Formats, Scope & Limitations
Large text in WCAG means at least `18 pt` (`24 px`) regular or `14 pt` (`~18.67 px`) bold. Normal body text requires at least `4.5:1` for AA.
Privacy & Local Processing
Evaluated locally in your browser.
Frequently Asked Questions
What contrast ratio does WCAG 2.1 Level AA require?
At least `4.5:1` for normal body text, and `3:1` for large text (≥ 24 px or ≥ 18.67 px bold) and active UI components/borders.
Does this handle alpha-transparent HEX colors like #0f172a80?
Yes—8-digit HEX alpha values composite over the background (and white beneath) before calculating contrast.
Converting HEX into RGB/RGBA or HSL values for your stylesheet? Open the HEX to RGB Converter.