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
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
.element {
color: #000000;
background-color: #ffffff;
}
Understanding WCAG Contrast
4.5:1 normal, 3:1 large text
7:1 normal, 4.5:1 large text
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
- Open the Color Contrast Checker. The default is black text on white background (21:1 ratio).
- Change the text color: use the color picker, type a hex code, or click a quick color button (#000000, #333333, #666666, #ffffff).
- Change the background color: use the color picker, type a hex code, or click a quick color button (#ffffff, #f8f9fa, #e9ecef, #000000).
- Review the contrast ratio and WCAG compliance cards. The live preview shows how your text will look.
- If contrast is low, check the Suggestions section. Click Apply on a suggestion to use the recommended color.
- Use Quick Presets to try common combinations. Use Swap to exchange foreground and background.
- 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.