Color Contrast Checker

Advertisement

Check if your color combinations meet WCAG accessibility standards for text readability.

Examples:
WCAG 2.2 12.63:1
APCA Score (Lc) Lc 97
The quick brown fox jumps over the lazy dog.
Large Text Sample
Bold text at 14pt weight 700
Button Link text
WCAG Level Normal Text Large Text UI Components
AA (Required)
AAA

APCA Minimum Font Sizes

Weight300400500600700

CSS Code

Color Blindness Simulation

The quick brown fox jumps over the lazy dog.
Large Text Sample
Advertisement

About This Tool

Color contrast checking is the process of measuring the luminance difference between foreground and background colors to determine whether text remains readable for all users, including those with visual impairments. The Web Content Accessibility Guidelines (WCAG), developed by the World Wide Web Consortium (W3C), establish the international standard for digital accessibility and define specific contrast ratio thresholds that every website and application should meet. WCAG 2.2 specifies two conformance levels for contrast. Level AA, the minimum standard required by most accessibility laws, demands a contrast ratio of at least 4.5:1 for normal text and 3:1 for large text (18pt regular or 14pt bold). Level AAA, the enhanced standard recommended for government, healthcare, and educational content, requires 7:1 for normal text and 4.5:1 for large text. These thresholds are based on research into how people with moderately low vision perceive on-screen content. Accessibility is also a legal obligation in many jurisdictions. The Americans with Disabilities Act (ADA) in the United States, Section 508 of the Rehabilitation Act, and the European standard EN 301 549 all mandate that digital content be perceivable by people with disabilities. Non-compliance can result in lawsuits, fines, and exclusion of a significant portion of your audience. This tool calculates contrast ratios by converting sRGB color values to linear RGB, computing relative luminance for each color using the ITU-R BT.709 coefficients, and applying the WCAG formula (L1 + 0.05) / (L2 + 0.05). It also provides color blindness simulation for protanopia, deuteranopia, and tritanopia, helping designers verify that their color choices work for the estimated 300 million people worldwide with color vision deficiency. In addition to the established WCAG 2.2 contrast ratio, this tool implements the Accessible Perceptual Contrast Algorithm (APCA), the contrast method proposed for WCAG 3.0. Unlike the traditional ratio, APCA accounts for the perceptual difference between dark text on a light background and light text on a dark background, producing a Lightness Contrast (Lc) value that better predicts real-world readability. APCA also provides font-size-specific guidance: for a given contrast level, it recommends minimum text sizes at different font weights, helping designers make precise typographic decisions. All calculations run locally in your browser.

Sources: WCAG 2.2 · SC 1.4.3 · SC 1.4.11

How to Use

  1. Enter your text (foreground) and background colors using the color pickers or by typing HEX codes.
  2. Check the contrast ratio and WCAG compliance results. Green indicates pass, red indicates fail.
  3. Use the color blindness simulation to verify your colors work for users with visual impairments.

How to Use

  1. Enter your text (foreground) and background colors using the color pickers or by typing HEX codes.
  2. Check the contrast ratio and WCAG compliance results. Green indicates pass, red indicates fail.
  3. Use the color blindness simulation to verify your colors work for users with visual impairments.

Methodology

The contrast ratio calculation follows the WCAG 2.2 algorithm precisely. First, each color's hex code is parsed into its red, green, and blue components, which are then normalized to values between 0 and 1 by dividing by 255. These linear values undergo gamma correction using the sRGB transfer function: values at or below 0.03928 are divided by 12.92, while larger values use the formula ((value + 0.055) / 1.055) raised to the power of 2.4. This gamma correction accounts for the nonlinear way displays emit light. Next, relative luminance is computed using the ITU-R BT.709 coefficients: L = 0.2126R + 0.7152G + 0.0722B. These weights reflect the human eye's differing sensitivity to each primary color, with green contributing most to perceived brightness. The final contrast ratio is calculated as (L1 + 0.05) / (L2 + 0.05), where L1 is the luminance of the lighter color. The 0.05 offset accounts for ambient light reflections on the display surface. Results range from 1:1 (identical colors) to 21:1 (pure black on pure white). The tool then evaluates this ratio against both AA and AAA thresholds for normal text and large text, providing a clear pass or fail result for each conformance level. The APCA calculation uses a different approach. It linearizes sRGB values using a simple power curve (gamma 2.4), applies perceptual luminance coefficients (0.2126729 R + 0.7151522 G + 0.0721750 B), and uses polarity-dependent exponents to model the asymmetry between dark-on-light and light-on-dark text. The resulting Lightness Contrast (Lc) value ranges from roughly -108 to 106, where positive values indicate dark text on a light background and negative values indicate the reverse. The absolute Lc value maps to minimum font sizes at each weight through a lookup table derived from the APCA specification.

Understanding Your Results

A contrast ratio of 4.5:1 or higher passes WCAG AA for normal text, which is the standard most websites and applications should target. A ratio of 3:1 passes AA for large text (18pt regular or 14pt bold and above) and is also sufficient for UI components such as form borders, icons, and focus indicators. For the enhanced AAA level, you need 7:1 for normal text and 4.5:1 for large text. When the tool shows a "Fail" result, it means users with moderate visual impairments may struggle to read that text. To improve contrast while preserving brand aesthetics, try darkening or lightening one color incrementally rather than replacing it entirely. Often a shift of just 10-15% in lightness is enough to cross the threshold. Common pitfalls include using light gray placeholder text, relying on thin font weights that reduce perceived contrast, and overlooking the contrast of disabled-state elements. The color blindness simulation results are equally important. Even if your colors pass the contrast ratio check, they may become indistinguishable for users with color vision deficiency. A red button on a green background might have adequate contrast for normal vision but appear nearly identical to someone with deuteranopia. Always verify your design across all simulated vision types, and use additional cues beyond color alone, such as icons, patterns, or text labels.

Practical Examples

A startup redesigning their marketing website tests their brand colors (#2563EB blue text on #F8FAFC light gray background) and finds a contrast ratio of 5.2:1, passing WCAG AA but failing AAA. They darken the blue to #1D4ED8, achieving 7.1:1 and meeting both standards without significantly altering their brand identity. A healthcare app developer checks their error message styling (red text on white) and discovers that #EF4444 on #FFFFFF only achieves 3.9:1, failing even AA for normal text. The color blindness simulation reveals it also appears dim to protanopia users. They switch to #DC2626 and add a warning icon. A UI designer validates that all button labels, form borders, and focus indicators in a component library meet at least the 3:1 requirement for non-text elements, while ensuring body text within those components hits the full 4.5:1 AA threshold.

Practical Tips for Accessible Design

Start by choosing high-contrast color pairs first, then build your palette around them. Aim for at least 7:1 contrast for body text even when only AA (4.5:1) is required, as this provides a comfortable safety margin. Never rely on color alone to convey information. Use icons, underlines, or text labels as secondary indicators so that color-blind users are not excluded. Test your designs in grayscale mode to quickly spot contrast problems. If elements disappear or blend together without color, the contrast is insufficient. Always check both light mode and dark mode. Dark themes often have lower effective contrast, especially with colored text on dark backgrounds. Verify hover and focus states separately, as these interactive states sometimes use lighter colors that fail contrast requirements. Install accessibility browser extensions like axe DevTools or WAVE to audit entire pages, and pair contrast checking with color blindness simulation to ensure comprehensive coverage.

All calculations are performed locally in your browser. No data is sent to any server.

Was this tool helpful?
Want to tell us more?
0/500
Want us to follow up?
Thanks for your feedback!

Frequently Asked Questions

What is WCAG contrast ratio?
WCAG contrast ratio measures the luminance difference between two colors on a scale from 1:1 (no contrast) to 21:1 (maximum contrast, black on white). The Web Content Accessibility Guidelines (WCAG) 2.2 require minimum contrast ratios to ensure text is readable for people with visual impairments.
What are the WCAG AA and AAA requirements?
WCAG AA requires 4.5:1 contrast for normal text and 3:1 for large text (18pt+ or 14pt bold). WCAG AAA (enhanced) requires 7:1 for normal text and 4.5:1 for large text. AA is the standard for most websites, while AAA provides better accessibility for users with more severe visual impairments.
What is considered large text?
Large text is defined as 18 point (24px) or larger for regular weight, or 14 point (18.66px) or larger for bold text. Large text has lower contrast requirements because it is easier to read at lower contrast ratios.
How is contrast ratio calculated?
Contrast ratio is calculated using the relative luminance of two colors, as defined in WCAG 2.2 Success Criterion 1.4.3. The formula is (L1 + 0.05) / (L2 + 0.05), where L1 is the lighter color's relative luminance and L2 is the darker color's. Relative luminance accounts for how the human eye perceives brightness differently across the color spectrum — green appears much brighter than blue at the same physical intensity. The resulting ratio ranges from 1:1 (identical colors, no contrast) to 21:1 (black on white, maximum contrast). WCAG AA requires at least 4.5:1 for normal text and 3:1 for large text.
What are common color combinations that fail WCAG?
The most common failures involve light colors on white backgrounds or similar low-contrast pairings. Red text on green backgrounds (and vice versa) often fails because the luminance values are similar despite looking 'different' in hue. Light gray text on white (#999 on #fff = 2.85:1, fails AA) is extremely common on websites. Yellow text on white is nearly always invisible (fails badly). Orange on white is borderline. Placeholder text styled in light gray (#aaa on #fff = 2.32:1) fails WCAG and is a widespread accessibility issue. When in doubt, check every text-background combination, including hover states and focus indicators.
Does dark mode need different contrast ratios?
No — the same WCAG contrast ratio requirements (4.5:1 for AA normal text, 3:1 for AA large text) apply regardless of whether the design uses light or dark mode. However, dark mode introduces unique challenges. White text on pure black (#fff on #000 = 21:1) actually causes visual discomfort for many users due to halation — bright text appears to bleed into the dark background, especially for people with astigmatism. Best practice for dark mode is to use off-white text on a dark gray background (e.g., #e0e0e0 on #1a1a1a = 13.28:1), which exceeds WCAG AAA while remaining comfortable to read.
How does sRGB affect WCAG contrast ratio calculation?
WCAG 2.2 defines relative luminance using the sRGB color space standard (IEC 61966-2-1). sRGB is the default color space for the web and most consumer displays. Before calculating luminance, each color channel (R, G, B) must be linearized using the sRGB transfer function — a gamma correction that converts the nonlinear display values into linear light intensity. Specifically, normalized channel values (0–1) at or below 0.04045 are divided by 12.92, while larger values use the formula ((value + 0.055) / 1.055) raised to the power of 2.4. This linearization is essential because display brightness is not proportional to the stored color value. Without sRGB linearization, contrast ratios would be inaccurate — particularly for mid-range colors where the gamma curve has the greatest effect. This tool applies the full sRGB transfer function as specified in WCAG 2.2 to ensure accurate results.
What is the difference between APCA and WCAG contrast?
WCAG 2.2 uses a simple luminance ratio formula that treats all text the same regardless of size, weight, or whether the text is dark on light or light on dark. The formula produces a ratio from 1:1 to 21:1 with fixed pass/fail thresholds. APCA (Accessible Perceptual Contrast Algorithm), proposed for WCAG 3.0, is a more advanced model. It accounts for the perceptual difference between dark text on a light background and light text on a dark background (polarity sensitivity). It produces a Lightness Contrast (Lc) value that better predicts real-world readability. APCA also provides font-size-specific guidance: for a given Lc value, it recommends minimum text sizes at different font weights. This means a heading at 32px can pass with lower contrast than body text at 16px, matching how human vision actually works. Both standards are available in this tool for comparison.
Can I use this as a contrast ratio calculator for non-web designs?
Yes. The contrast ratio formula uses universal sRGB luminance values that apply to any medium where colors are displayed on a screen — including mobile apps, desktop software, digital signage, kiosks, and presentations. The calculation measures the objective luminance difference between two colors, which is a physical property independent of the delivery medium. The WCAG AA and AAA thresholds (4.5:1 and 7:1) were developed for web content, but the underlying contrast ratio is equally useful for evaluating readability in any digital context. Many mobile app accessibility guidelines, including Apple's Human Interface Guidelines and Google's Material Design, reference the same contrast ratio scale. For print design, the same formula provides a useful approximation, though printed colors depend on ink, paper, and lighting conditions that differ from screen display.
How do I use this color contrast checker?
Enter your text (foreground) color and background color using the color pickers, or type HEX codes directly. You can also switch to RGB or HSL input using the format tabs, or use the eyedropper button to pick colors directly from your screen. The tool instantly shows your WCAG 2.2 contrast ratio and APCA score, with pass/fail badges for each compliance level. The live preview area shows how your text actually looks at different sizes and weights. If your colors fail, the tool suggests the closest passing alternatives for both AA and AAA levels. You can also check how your color combination appears to people with different types of color vision using the color blindness simulation tabs. Use the share button to copy a link with your current color settings, making it easy to share results with your team.
Is my color data private when using this tool?
Yes, completely. All contrast calculations run entirely in your browser using JavaScript. No color data, results, or settings are ever sent to any server. The tool works offline once loaded, and your color choices are never stored, tracked, or shared. When you use the share link feature, your colors are encoded in the URL itself — they are not uploaded anywhere.