Color Contrast Checker

Test text and background color combinations for WCAG 2.1 AA and AAA compliance with live preview and accessibility suggestions

Color Contrast Checker

21:1
Excellent
AA
Normal
Pass
4.5:1
AA
Large
Pass
3:1
AAA
Normal
Pass
7:1
AAA
Large
Pass
4.5:1

Sample Heading Text

This is how your text will appear. Good contrast ensures readability for all users.

Small text (13px) requires higher contrast.

Great Contrast!

Your colors meet WCAG guidelines.

Technical Details

FG Luminance
0.0000
BG Luminance
1.0000
.element {
  color: #000000;
  background-color: #ffffff;
}

Understanding WCAG Contrast

AA
Level AA

4.5:1 normal, 3:1 large text

AAA
Level AAA

7:1 normal, 4.5:1 large text

Why It Matters

Helps users with low vision

What is Color Contrast Checker?

Color Contrast Checker is an online tool that tests whether a combination of text color (foreground) and background color meets accessibility standards. You enter or pick two colors, and the tool instantly calculates the contrast ratio, checks WCAG 2.1 AA and AAA compliance for normal and large text, and displays a live preview of how your text will look. If the contrast is insufficient, the tool suggests alternative colors (darker or lighter foreground or background) that would pass. You can apply presets, swap colors, copy hex values, and export ready-to-use CSS. The tool helps designers, developers, and content creators ensure their designs are readable for everyone, including people with low vision, color blindness, or age-related vision changes. It is free, requires no registration, and runs entirely in your browser with real-time updates as you change colors.

Web Content Accessibility Guidelines (WCAG) define minimum contrast ratios for text. Level AA requires 4.5:1 for normal text and 3:1 for large text. Level AAA requires 7:1 for normal text and 4.5:1 for large text. Large text is typically 18px or 14px bold. The Color Contrast Checker calculates the contrast ratio using the relative luminance formula from WCAG and displays pass or fail for each level. A circular indicator shows the ratio with color-coded feedback: green for excellent (7:1 or higher), yellow for good (4.5:1 to 7:1), orange for fair (3:1 to 4.5:1), and red for poor (below 3:1). Four cards show AA normal, AA large, AAA normal, and AAA large compliance at a glance.

The tool provides a live preview panel where your chosen colors are applied to sample heading text, body text, and small text. This lets you see exactly how the combination will look in context. You can enter colors as hex codes (e.g., #000000, #ffffff) or use the color picker. Quick color buttons for common values (black, dark gray, medium gray, white for text; white, light gray, medium gray, black for background) let you switch quickly. A swap button exchanges foreground and background. Eight presets (Default, Link on White, Gray on White, White on Blue, White on Dark, Yellow on Black, Red Warning, Green Success) apply common combinations with one click. Copy buttons let you copy hex values or the generated CSS to your clipboard.

When contrast is below AAA normal (7:1), the tool generates suggestions. Each suggestion shows whether to make the foreground or background darker or lighter, the suggested hex color, the resulting contrast ratio, and an Apply button. Applying a suggestion updates the color and recalculates. If your combination already meets WCAG guidelines, the tool shows a "Great Contrast!" message instead of suggestions. Technical details include foreground and background luminance values, which are used in the WCAG contrast formula. The CSS code section outputs the exact rules you need for your stylesheet, with a copy button for easy integration.

Color contrast affects readability for everyone, not just people with disabilities. Low contrast text strains the eyes in bright light, on small screens, or when viewed from a distance. High contrast improves comprehension and reduces errors. Many jurisdictions require WCAG compliance for public sector and some private sector websites. The Color Contrast Checker helps you meet these requirements during design and development, rather than discovering failures during an audit. It supports both light-on-dark and dark-on-light combinations and works with any hex color. The tool uses the standard WCAG 2.1 relative luminance formula, so results align with official accessibility testing.

Designers use the tool when choosing brand colors, building design systems, or validating mockups. Developers use it when implementing styles, building components, or fixing accessibility issues flagged by audits. Content creators use it when selecting text colors for overlays on images or custom backgrounds. QA testers use it to verify that implemented designs match accessibility requirements. The tool does not require uploading files or connecting to external services; all calculations run locally. Changes update in real time as you type or pick colors, so you can iterate quickly to find a compliant combination that fits your design.

Who Benefits from This Tool

Web designers and UX professionals use the Color Contrast Checker to validate color choices before handing off to development. When creating mockups or design systems, they can ensure that text and background combinations meet WCAG before implementation. This reduces rework and prevents accessibility failures from reaching production. Designers working on dark mode or high-contrast themes use the tool to verify that both light and dark variants pass.

Front-end developers use the tool when implementing styles, building reusable components, or fixing accessibility issues. When a design specifies colors that fail contrast, the developer can use the suggestions to find a compliant alternative that stays close to the original. The CSS output and copy buttons streamline integration. Developers maintaining design systems use the tool to document and validate the contrast of each color pair in the palette.

Content creators and marketers use the tool when adding text overlays on images, creating social graphics, or designing email templates. Ensuring sufficient contrast improves readability and engagement. Accessibility coordinators and compliance officers use the tool to verify that websites meet WCAG requirements. QA engineers use it during accessibility testing to confirm that implemented designs pass contrast checks. Educators teaching web accessibility use the tool to demonstrate how contrast ratios work and why they matter.

Key features

Text and Background Color Input

Enter hex codes or use the color picker for both text (foreground) and background. The tool accepts standard hex format (#000000, #fff, etc.). Changes update in real time with wire:model.live.

Live Preview

A preview panel shows sample heading, body text, and small text in your chosen colors. See exactly how the combination will look before implementing.

Contrast Ratio and WCAG Compliance

Displays the contrast ratio (e.g., 4.5:1) with a visual indicator (Excellent, Good, Fair, Poor). Four cards show pass/fail for WCAG AA normal (4.5:1), AA large (3:1), AAA normal (7:1), and AAA large (4.5:1).

Suggestions

When contrast is low, the tool suggests making the foreground or background darker or lighter. Each suggestion shows the new color, resulting ratio, and an Apply button to apply it instantly.

Quick Presets

Eight presets: Default, Link on White, Gray on White, White on Blue, White on Dark, Yellow on Black, Red Warning, Green Success. One click applies the preset.

Swap Colors

Swap foreground and background with one click. Useful when testing both light-on-dark and dark-on-light.

Copy Hex and CSS

Copy buttons for hex values and generated CSS. The CSS output includes color and background-color rules ready for your stylesheet.

Technical Details

Shows foreground and background luminance values used in the WCAG formula. Helps advanced users understand the calculation.

How to use

  1. Open the Color Contrast Checker. The default is black text on white background (21:1 ratio).
  2. Change the text color: use the color picker, type a hex code, or click a quick color button (#000000, #333333, #666666, #ffffff).
  3. Change the background color: use the color picker, type a hex code, or click a quick color button (#ffffff, #f8f9fa, #e9ecef, #000000).
  4. Review the contrast ratio and WCAG compliance cards. The live preview shows how your text will look.
  5. If contrast is low, check the Suggestions section. Click Apply on a suggestion to use the recommended color.
  6. Use Quick Presets to try common combinations. Use Swap to exchange foreground and background.
  7. Copy the hex values or CSS code as needed. Integrate the colors into your design or stylesheet.

Common use cases

  • Validating brand color combinations for accessibility
  • Choosing text colors for overlays on images or hero sections
  • Building accessible design systems and component libraries
  • Fixing contrast failures flagged in accessibility audits
  • Testing dark mode and high-contrast theme variants
  • Designing accessible forms, buttons, and links
  • Creating accessible social media graphics and email templates
  • Documenting color pair contrast in style guides
  • Teaching WCAG contrast requirements in accessibility courses
  • Quick checks during design review or QA

Tips & best practices

Start with your brand or design colors and test them. If they fail, use the suggestions to find the closest compliant alternative. Darkening text or lightening background (or vice versa) by a small amount often achieves compliance without a drastic visual change. For large text (headings, 18px+), the requirements are lower (3:1 for AA, 4.5:1 for AAA), so you have more flexibility.

Test both normal and large text. A combination that passes for large text may fail for body text. If your design uses multiple text sizes, ensure the smallest text meets the required ratio. Consider testing with real content: placeholder text may not reflect actual line length or font weight. Bold text can appear to have better contrast than regular weight; the WCAG formula does not account for font weight, so err on the side of higher contrast for body text.

Use the presets as starting points. Link on White, Gray on White, and similar presets show common patterns. Swap colors to see dark-on-light vs light-on-dark. The tool does not store your color history; if you find a good combination, copy the hex values or CSS immediately. For design systems, document each approved color pair and its contrast ratio so future updates stay compliant.

Remember that contrast is one of many accessibility requirements. Color alone should not convey meaning; use icons, labels, or patterns as well. Some users need high contrast beyond WCAG minimums; offering a high-contrast theme or user preference improves the experience. The tool checks contrast only; it does not evaluate color blindness simulation or other visual considerations.

Limitations & notes

The tool evaluates a single foreground-background pair. Real interfaces may have multiple layers (e.g., text on a card on a page background). Test each distinct combination. The tool uses the WCAG 2.1 formula; WCAG 2.2 introduces additional contrast requirements for UI components and graphics that this tool does not evaluate.

Contrast ratios assume standard text rendering. Custom fonts, anti-aliasing, or subpixel rendering can affect perceived contrast. The tool provides a reliable baseline; for critical applications, test with real users. The suggestions aim for 4.5:1 (AA normal) as a minimum; they do not guarantee AAA. Apply a suggestion and re-check if you need AAA compliance.

The tool accepts hex input only. RGB, HSL, or named colors must be converted to hex first. Color pickers in design software can provide hex values. The luminance calculation uses the sRGB color space; colors in other spaces may have different perceived contrast. For most web design use cases, hex and sRGB are standard.

Accessibility regulations vary by region. In the United States, Section 508 and the Americans with Disabilities Act (ADA) have been interpreted to require accessible websites for many organizations. The European Accessibility Act and similar laws in other countries mandate WCAG compliance. Using the Color Contrast Checker during design and development helps you meet these requirements proactively. Catching contrast failures early is far cheaper than remediating after launch or facing legal action. The tool supports a culture of inclusive design where accessibility is considered from the start.

Design systems and component libraries benefit from documented contrast. When you define a primary button color, document which text colors pass on that background. When you add a new brand color, test it against your standard backgrounds. The Color Contrast Checker makes this quick: run through your palette, record the ratios, and add them to your style guide. Future designers and developers can reference the documentation instead of re-testing. This consistency improves both accessibility and design coherence across products.

Real-time feedback accelerates the design process. As you adjust colors in the picker or type hex codes, the contrast ratio, WCAG cards, and live preview update immediately. There is no submit button for the core check; the tool is always showing the current state. This instant feedback encourages experimentation: try a slightly darker gray, see the ratio improve, and apply the suggestion if needed. The tool supports an iterative workflow where you refine colors until they meet both aesthetic and accessibility goals.

FAQs

What is the contrast ratio?

It is the ratio of the luminance of the lighter color to the darker color, plus a small constant. For example, 4.5:1 means the lighter color is 4.5 times as bright as the darker. Higher ratios mean better contrast and readability.

What is WCAG AA vs AAA?

AA is the minimum level for most compliance. AAA is stricter and recommended for critical content. AA requires 4.5:1 for normal text; AAA requires 7:1. Large text has lower requirements (3:1 for AA, 4.5:1 for AAA).

What counts as large text?

WCAG defines large text as 18px or 14px bold. The tool checks both normal and large; use the large column if your text meets that size.

Why do I get suggestions?

Suggestions appear when contrast is below AAA normal (7:1). The tool tries darkening or lightening the foreground or background to find a combination that reaches at least 4.5:1. Click Apply to use a suggestion.

Can I use the tool for non-web design?

Yes. The contrast formula applies to any text and background combination. Use it for print, presentations, or signage. Enter colors as hex; you may need to convert from other formats.

Does the tool support color blindness?

The tool checks luminance contrast only. It does not simulate color blindness or evaluate whether color pairs are distinguishable for color-blind users. For that, use a dedicated color blindness simulator.

What are luminance values?

Luminance is the perceived brightness of a color. The WCAG formula converts RGB to relative luminance using specific coefficients. The tool displays these values in the Technical Details section for transparency.

Can I copy the CSS?

Yes. The CSS code section shows the color and background-color rules. Click the copy button to copy to your clipboard. Paste into your stylesheet or component.

Why does my design fail in an audit but pass here?

Audits may check additional criteria (e.g., focus indicators, graphics) or use different tools. Ensure you are testing the exact colors used in production. Some audits flag decorative text that does not need to meet contrast; WCAG has exceptions for incidental text.

What hex format does the tool accept?

Standard hex: #RRGGBB (e.g., #000000) or shorthand #RGB (e.g., #fff). The tool normalizes input and supports both formats.

How do I achieve AAA compliance?

Aim for 7:1 or higher for normal text. Use darker text on light backgrounds or lighter text on dark backgrounds. The suggestions, when available, show alternatives; some may reach 7:1. Black on white (21:1) and white on black (21:1) always pass.

Does the tool work with transparent backgrounds?

No. The tool evaluates opaque foreground and background. Transparent or semi-transparent colors would require knowing the underlying background; test the final rendered combination.

What are the quick presets?

Default (black on white), Link on White, Gray on White, White on Blue, White on Dark, Yellow on Black, Red Warning, Green Success. They demonstrate common patterns and provide starting points for testing.

Can I use this for mobile app design?

Yes. The contrast formula applies regardless of platform. Enter your app's colors and check compliance. Mobile interfaces often need to meet the same or similar accessibility standards.

What if I have multiple text colors on one background?

Test each text color separately against the background. A page might have black body text and blue links on white; check both combinations. The tool evaluates one pair at a time.

Does the tool work offline?

Once the page is loaded, the tool runs entirely in the browser. Color calculations and suggestions do not require a network connection. You can use it offline after the initial load.