A color contrast checker helps you verify whether text, controls, icons, borders, and interactive states remain distinguishable for more people. This guide explains WCAG contrast ratios, shows how to test real UI combinations, and provides a reusable checklist for design reviews, development, and release testing.
Overview
Color contrast is the measurable difference in perceived brightness between a foreground color and its background. A contrast-ratio tool compares those colors and returns a value such as 4.5:1 or 7:1. The higher the first number, the stronger the contrast.
Contrast checking is not limited to choosing a readable text color from a palette. A complete review should cover every important combination in the interface: body copy, headings, links, buttons, form fields, icons, borders, focus indicators, placeholder text, hover states, dark mode, and text placed over images or gradients.
For most web projects, use the following WCAG reference points as a practical starting point:
| Content or control | Common minimum target | What to test |
|---|---|---|
| Normal-sized text | 4.5:1 for AA | Paragraphs, labels, navigation, metadata, and button text |
| Large text | 3:1 for AA | Text that meets the applicable large-text size and weight definition |
| Enhanced text contrast | 7:1 for AAA normal text | Interfaces targeting a stricter text contrast level |
| User-interface components and graphical objects | 3:1 | Inputs, controls, focus indicators, meaningful icons, and essential boundaries |
These values are thresholds, not design goals. A combination that barely passes can become difficult to read because of font weight, anti-aliasing, display quality, glare, or surrounding colors. Where the design allows it, choose a stronger margin than the minimum and confirm the result in the rendered interface.
A browser-based color contrast checker is useful during palette exploration, but it does not replace accessibility testing. A two-color swatch cannot show whether text is obscured by an image, whether a focus ring disappears against a border, or whether a hover state is noticeable without relying on color alone.
Checklist by scenario
1. Normal text and headings
- Identify the exact foreground color, including inherited CSS variables and opacity.
- Identify the actual background behind the text rather than the intended design token alone.
- Run the pair through a color contrast checker and record the ratio.
- Test body copy separately from headings because size, weight, and rendering may differ.
- Check links in their default, hover, visited, and focus states.
Do not assume that large text makes every contrast problem acceptable. Confirm that the rendered font size and weight meet the definition used by your chosen accessibility target. If a heading changes size across breakpoints, test the smallest version users will see.
2. Buttons, links, and form controls
- Test button text against the button background in its default state.
- Test hover, active, focus, and loading states rather than checking only the default style.
- Check text inside disabled controls separately; do not use disabled styling as a model for active controls.
- Test input text, labels, helper text, error messages, and success messages.
- Check borders and other visual boundaries when they communicate the location or state of a control.
A control can have readable text but still be hard to find if its boundary blends into the page. Conversely, a border may be decorative rather than essential. Judge each visual feature by the information it communicates and verify it in context.
3. Icons, logos, and graphical information
- Test standalone icons when they convey meaning or provide an action, such as search, delete, menu, or status.
- Check an icon against every background on which it appears.
- Test meaningful parts of charts, diagrams, badges, and illustrations.
- Do not rely on color alone to distinguish statuses, categories, or validation results; add text, shape, pattern, or another visual cue where appropriate.
- Separate decorative branding from functional or informational graphics during review.
For multi-color graphics, test the important edges and adjacent colors. A chart may pass when one series is isolated but become confusing when several series overlap or sit next to one another.
4. Focus indicators and keyboard states
- Place keyboard focus on a representative page background and test the focus indicator against that background.
- Test focus on cards, buttons, inputs, links, menus, and components with colored borders.
- Check whether the indicator remains visible when a component changes color on focus.
- Use more than a subtle color shift when the state needs to be found quickly.
Contrast is one part of focus visibility. The indicator also needs sufficient size, placement, and separation from nearby edges. Review it with keyboard navigation in the browser, not just in a design file.
5. Placeholder text, overlays, images, and gradients
- Test placeholder text as real instructional or field-related content, not as an exception simply because it disappears later.
- Check text over images at the lightest and darkest areas behind the text.
- Test gradients at multiple points; one passing sample does not represent the whole gradient.
- Check translucent overlays after the browser composites them with the page background.
- Use a solid panel, text shadow, overlay, or layout change when a reliable contrast result cannot be achieved over changing imagery.
6. Dark mode and responsive themes
- Run the full text and component inventory again for dark mode; do not invert colors mechanically.
- Check muted text, borders, separators, code blocks, selected states, and focus rings.
- Test system theme changes and any user-controlled theme setting.
- Verify that CSS variables resolve to the expected values in every theme and breakpoint.
Dark interfaces often create problems with low-opacity white text, dark gray surfaces, and nearly invisible borders. Strong contrast does not require pure black and white, but each role in the palette should remain distinguishable and readable.
What to double-check
Use the actual rendered colors
Design tokens can hide important details. A token may be blended with an overlay, reduced with opacity, altered by a hover rule, or overridden by a component stylesheet. Inspect the element in the browser and copy the computed colors when possible. Then compare the real foreground and background pair in the checker.
Test more than a swatch
Start with a color contrast checker for fast pair testing, then validate a real component. Render the smallest text size, the longest label, the most crowded layout, and the relevant states. A component review should include its surrounding surface because contrast can change when the same component appears in a modal, card, table, banner, or footer.
Check color behavior in context
Contrast ratios describe luminance difference, not every aspect of perception. Thin fonts, tightly spaced text, motion, patterned backgrounds, and adjacent saturated colors can affect usability even when a pair passes. Read the interface at normal zoom and inspect it under different display conditions when the component is important.
Separate contrast from other accessibility checks
A passing ratio does not confirm that the page works with a keyboard, screen reader, magnification, or high-contrast settings. Pair color review with semantic markup, visible focus, labels, error identification, and interaction testing. The web accessibility testing workflow provides a broader release checklist for these related checks.
Keep a design-system record
Record approved foreground and background combinations by purpose: body text, muted text, link, primary action, danger state, focus indicator, and surface. Include the ratio, theme, component context, and any limitations. This prevents each new component from re-solving the same palette problem and makes review easier when tokens change.
Common mistakes
- Checking only the default state: Hover, focus, active, selected, error, and success styles may use different colors.
- Testing the background token instead of the rendered background: Transparency, images, gradients, and overlays can change the result.
- Treating color as the only status signal: Add text or another clear visual distinction for success, warning, error, and category states.
- Assuming gray text is harmless: Muted metadata, captions, timestamps, and helper text still need to be readable when they carry information.
- Ignoring component boundaries: A light border on a light surface can make an input or card difficult to locate.
- Relying on automated scans alone: Automated tools can find many color pairs, but they may miss overlays, gradients, state changes, and whether a visual is meaningful.
- Changing text color without checking its role: A fix for one surface may fail when the same token is reused on another surface.
- Confusing a passing ratio with good design: Aim for clear hierarchy and comfortable reading, not merely a result just above the threshold.
When to revisit
Make contrast review part of the workflow whenever its inputs change. Recheck the interface when you:
- introduce a new brand palette, theme, or dark-mode variant;
- change typography, font weight, component size, or responsive breakpoints;
- add a new button, form pattern, data visualization, banner, or status system;
- replace imagery, gradients, overlays, or surface colors;
- modify focus, hover, disabled, selected, error, or loading states;
- update design tokens or refactor shared CSS variables;
- prepare a release candidate or complete a seasonal campaign refresh;
- change the browser, component library, rendering method, or design-system tooling.
For a practical release pass, export or list every color role, pair each role with its real background, and test normal text, large text, controls, icons, borders, focus states, gradients, and both themes. Fix failures at the token or component level where possible, then retest the rendered page with keyboard navigation. Save the results with the design-system documentation so the next palette or workflow change starts with a reliable baseline.