User Rating 0.0 โ˜…โ˜…โ˜…โ˜…โ˜…
Total Usage 0 times
Category CSS Tools
Presets:
โ€” Contrast Ratio
AA Normal โ‰ฅ 4.5:1 โ€”
AA Large โ‰ฅ 3:1 โ€”
AAA Normal โ‰ฅ 7:1 โ€”
AAA Large โ‰ฅ 4.5:1 โ€”
Normal text sample โ€” The quick brown fox jumps over the lazy dog. Large text sample โฌค UI Component
FG Luminance โ€”
BG Luminance โ€”
FG HSL โ€”
BG HSL โ€”
Is this tool helpful?

Your feedback helps us improve.

โ˜… โ˜… โ˜… โ˜… โ˜…

About

Incorrect color contrast is the single most common accessibility violation on the web. The Web Content Accessibility Guidelines (WCAG 2.1) define precise thresholds: a contrast ratio of at least 4.5:1 for normal text (Level AA) and 7:1 for enhanced readability (Level AAA). Failing these thresholds means your content is illegible to roughly 300 million people with color vision deficiencies. This tool computes the relative luminance L of both your foreground and background colors using the sRGB linearization model specified in WCAG 2.1 ยง1.4.3, then derives the contrast ratio CR. It does not approximate. It uses the exact gamma-corrected formula mandated by the standard.

Note: this tool assumes opaque colors. If your foreground uses alpha transparency, the effective contrast depends on the composite result against the actual background, which varies by rendering context. Pro Tip: large text is defined as 18pt regular or 14pt bold. Misidentifying your text size leads to false compliance.

color contrast WCAG accessibility a11y contrast ratio web design ADA compliance color checker

Formulas

The contrast ratio between two colors is derived from their relative luminance values. First, each sRGB channel is linearized:

Clin =
{
CsRGB12.92 if CsRGB โ‰ค 0.04045(CsRGB + 0.0551.055)2.4 otherwise

where CsRGB is the channel value divided by 255. Relative luminance is then:

L = 0.2126 โ‹… Rlin + 0.7152 โ‹… Glin + 0.0722 โ‹… Blin

The contrast ratio between two luminances L1 (lighter) and L2 (darker) is:

CR = L1 + 0.05L2 + 0.05

Where L1 โ‰ฅ L2. The result ranges from 1:1 (identical colors) to 21:1 (black on white). Rlin, Glin, Blin are the linearized red, green, and blue channel values respectively. CR is the contrast ratio. The coefficients 0.2126, 0.7152, 0.0722 reflect human photopic sensitivity per ITU-R BT.709.

Reference Data

WCAG LevelText SizeMin. Contrast RatioUse Case
AANormal (< 18pt)4.5:1Body text, labels, form fields
AALarge (โ‰ฅ 18pt or 14pt bold)3:1Headings, large UI elements
AAANormal (< 18pt)7:1Long-form reading, legal text
AAALarge (โ‰ฅ 18pt or 14pt bold)4.5:1Critical navigation, alerts
AAUI Components & Graphics3:1Icons, borders, focus indicators
Non-textIncidental / DecorativeNo requirementDisabled controls, logos
ReferenceBlack on White21:1Maximum possible contrast
ReferenceWhite on White1:1Minimum possible (invisible)
Common FailLight gray (#999) on white2.85:1Placeholder text (fails AA)
Common FailRed (#FF0000) on black5.25:1Error states (passes AA)
Common FailYellow (#FFFF00) on white1.07:1Highlight text (fails all)
GuidelineWCAG 2.1 ยง1.4.3Level AAMinimum conformance for text
GuidelineWCAG 2.1 ยง1.4.6Level AAAEnhanced conformance for text
GuidelineWCAG 2.1 ยง1.4.11Level AANon-text contrast (UI, graphics)
StandardSection 508 (US)Maps to WCAG AAUS federal accessibility law
StandardEN 301 549 (EU)Maps to WCAG AAEuropean accessibility standard

Frequently Asked Questions

Large text (โ‰ฅ 18pt regular or โ‰ฅ 14pt bold) has a lower contrast threshold of 3:1 for AA compliance, while normal text requires 4.5:1. Larger glyphs have thicker strokes that remain legible at lower contrast. If your ratio falls between 3:1 and 4.5:1, it passes only for large text. Increase the lightness difference between your foreground and background to reach the 4.5:1 threshold for body copy.
This tool assumes fully opaque colors. When a foreground color has alpha transparency (e.g., rgba(0,0,0,0.5)), the effective rendered color is a composite of the foreground and whatever lies beneath it. The actual contrast depends on the composited result, not the raw RGBA value. To check transparent colors accurately, first composite them against the known background using the formula: C_out = C_fg ร— ฮฑ + C_bg ร— (1 โˆ’ ฮฑ), then input the resulting opaque color.
Not entirely. WCAG contrast ratios are based on luminance perception, which is preserved in most forms of color blindness (protanopia, deuteranopia, tritanopia). However, relying solely on color to convey information (e.g., red vs. green for error/success) violates WCAG 1.4.1 regardless of contrast ratio. A color pair can pass 4.5:1 contrast and still be indistinguishable to a dichromat if both colors share similar luminance. Always use additional cues: icons, patterns, or text labels.
WCAG 2.1 uses a simple luminance ratio that treats foreground and background symmetrically. The Advanced Perceptual Contrast Algorithm (APCA), proposed for WCAG 3.0, accounts for polarity (dark-on-light vs. light-on-dark perceive differently), font weight, and spatial frequency. APCA reports a signed Lc value rather than a ratio. As of 2024, WCAG 2.1 AA remains the legal standard referenced by Section 508 and EN 301 549. This tool implements the WCAG 2.1 algorithm.
Human vision derives approximately 71.52% of perceived brightness from the green channel, 21.26% from red, and only 7.22% from blue (ITU-R BT.709 coefficients). Pure red (#FF0000) has zero green and blue components, so its relative luminance is only about 0.2126. Black has luminance 0. The ratio computes to (0.2126 + 0.05) / (0 + 0.05) โ‰ˆ 5.25:1. This passes AA for normal text but fails AAA. Pure green (#00FF00) by contrast achieves approximately 15.3:1 against black.
Adjust the lightness component while keeping hue and saturation constant. Convert your color to HSL. For a dark background, increase the foreground lightness. For a light background, decrease it. Small lightness shifts of 10-15% often bridge the gap from 3:1 to 4.5:1 without perceptible brand deviation. This tool provides automatic suggestions that darken or lighten your colors to the nearest passing threshold.