Skip to content
Toolcroft

Color Contrast Checker (WCAG)

Color Tools

Check the WCAG 2.x contrast ratio between any two colors. Instantly see pass/fail results for AA and AAA levels across normal text, large text, and UI components. Runs entirely in your browser.

Normal text (16 px) - The quick brown fox jumps over the lazy dog.

Large text (18 pt / 24 px regular, or 14 pt / 18.7 px bold) - The quick brown fox.

Display (30 px bold)

21.00:1
✓ AA Normal✓ AA Large✓ AA UI✓ AAA Normal✓ AAA Large
LevelContextRequiredResult
AANormal text4.5:1Pass
AALarge text3.0:1Pass
AAUI components3.0:1Pass
AAANormal text7.0:1Pass
AAALarge text4.5:1Pass

How to use this tool

  1. Enter a foreground color. Type or paste a hex, RGB, or HSL color value into the Foreground field, or use the color picker.
  2. Enter a background color. Type or paste a hex, RGB, or HSL color value into the Background field, use the color picker, or swap the two colors. Use the actual opaque background color for the comparison.
  3. Read the contrast ratio. The ratio (e.g., 4.52:1) and WCAG pass/fail badges update instantly. If AA Normal fails, apply a same-hue lightness suggestion that reaches 4.5:1.
  4. Preview text on background. Preview normal text and WCAG large text on the chosen background; large text is at least 18 pt regular or 14 pt bold.

How WCAG contrast ratio is calculated

The contrast ratio between two colors is defined by WCAG 2.x as:

(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. Relative luminance is calculated by first converting each sRGB channel value (0–255) to a linear light value (using a gamma-correction curve), then weighting by the standard luminance coefficients:

L = 0.2126 × R_lin + 0.7152 × G_lin + 0.0722 × B_lin

These coefficients reflect how the human eye perceives brightness: we are much more sensitive to green than to blue. The +0.05 offset prevents a division-by-zero when comparing against pure black and ensures the ratio scales from 1:1 (identical colors) to 21:1 (black on white).

When AA Normal fails, the checker searches darker and lighter HSL values for either color, preserving that color's hue and saturation. Each suggestion reaches at least 4.5:1 while changing only one color; choose a suggestion to apply it. Alpha is ignored in rgba(), hsla(), and 8-digit hex values, so translucent colors are treated as fully opaque. For accurate results, enter the color after blending it against its actual opaque background.

What ratio do I need for AA / AAA?

WCAG 2.1 defines three conformance levels (A, AA, AAA) and two text sizes:

  • AA Normal text: 4.5:1 minimum. Required for body copy, navigation links, and most UI text smaller than 18 pt regular or 14 pt bold.
  • AA Large text: 3:1 minimum. Applies to text at 18 pt (24 px) regular or 14 pt (approximately 18.67 px) bold and above.
  • AA UI components & graphical objects: 3:1 minimum. Applies to active interface components (input borders, focus rings, icon-only buttons) and meaningful parts of charts and diagrams.
  • AAA Normal text: 7:1 minimum. The highest threshold; ideal for body copy read by users with significant low vision.
  • AAA Large text: 4.5:1 minimum. The same as AA for normal text, but for large text.

Most design systems target AA at minimum. AAA is aspirational and may not be achievable for decorative text or logos, which are exempt from contrast requirements entirely.

WCAG 3.0 and APCA

The W3C is developing WCAG 3.0, which will replace the current contrast ratio formula with the Advanced Perceptual Contrast Algorithm (APCA). APCA is polarity-aware (light text on dark background is evaluated differently from dark text on light), uses a non-linear model that better matches human perception, and produces a different numeric scale (Lc values typically 0–106 rather than 1:1 to 21:1). WCAG 3.0 is not yet published as a final recommendation and is not currently required by law or standard procurement. Continue targeting WCAG 2.1 AA for current projects.

Common failing color combinations

TextBackgroundContrast ratioResult
Gray (#767676)White (#FFFFFF)4.54:1AA pass (barely)
Gray (#6B6B6B)White (#FFFFFF)4.12:1AA fail
Light gray (#BBBBBB)White (#FFFFFF)1.97:1Fail
Yellow (#FFFF00)White (#FFFFFF)1.07:1Fail (nearly invisible)
Light blue (#ADD8E6)White (#FFFFFF)1.68:1Fail
Red (#FF0000)White (#FFFFFF)3.99:1AA fail for normal text
Dark green (#006400)Black (#000000)1.55:1Fail
Purple (#800080)Dark blue (#00008B)1.09:1Fail

Design tokens and automated testing

In a design system, design tokens (e.g., --color-text-primary, --color-bg-surface) define canonical color pairings. Automated contrast checks can be run at build time using tools such as axe-core, Storybook's accessibility addon, or Playwright with axe-playwright. Catching contrast failures during development is far less expensive than remediating them after production deployment.

Frequently asked questions

What is WCAG contrast ratio?

WCAG (Web Content Accessibility Guidelines) defines a contrast ratio formula that compares the relative luminance of two colors. A ratio of 1:1 means identical colors; 21:1 is the maximum (black on white). The ratio ensures text and UI elements are readable for people with low vision or color blindness.

What ratio do I need for WCAG AA?

WCAG 2.1 Level AA requires a minimum contrast ratio of 4.5:1 for normal text (below 18pt / 14pt bold) and 3:1 for large text (18pt regular or 14pt bold and above). UI components such as input borders and focus indicators also need 3:1.

What ratio do I need for WCAG AAA?

WCAG 2.1 Level AAA requires 7:1 for normal text and 4.5:1 for large text. AAA is the highest conformance level and is recommended for text that many people with low vision will need to read without assistive technology.

Does the contrast ratio change with font size?

Yes. WCAG distinguishes "normal text" (smaller than 18pt regular or 14pt bold) from "large text" (18pt regular or 14pt bold and above). Large text gets a lower minimum ratio because it is easier to read at lower contrast. This tool checks both thresholds simultaneously.

Can I enter colors in any format?

The tool accepts hex (#RRGGBB or #RGB), rgb() / rgba(), and hsl() / hsla() formats. Alpha is ignored, including the alpha byte in 8-digit hex, so translucent values are checked as if fully opaque. For accurate results, enter the color after blending it against its actual opaque background. The native color picker selects opaque colors.

Browse all color tools