What is wcag contrast checking?
Contrast ratio compares the relative luminance of two solid colours. It is one measurable part of accessible interface design, helping you evaluate body text, large headings, and essential visible component boundaries against WCAG thresholds.
This free browser-based tool makes the relationship between controls and results visible immediately. Start from the supplied example instead of building a configuration from scratch. Every adjustment updates the result locally, so you can compare alternatives without exporting assets or repeatedly changing a stylesheet. The goal is a deliberate, reusable decision rather than an effect that looks impressive only in isolation.
How to use it
- Enter Text colour and Background colour using hex values or the colour pickers. Use Swap colours to reverse their roles.
- Read the ratio and the five pass-or-fail tiles, then inspect the live heading, paragraph, and example control.
- Review the nearest AA normal text suggestion and choose Apply if you want to use it. Copy the resulting CSS declarations when the pair is ready.
Work through those steps with a representative piece of your interface in mind. A navigation panel, an article heading, and a marketing illustration have different constraints. Change one setting at a time when evaluating a result; otherwise it becomes difficult to tell which adjustment improved the design. Keep a copy of a promising result before exploring a substantially different direction.
Understanding the output
Ratios range from 1:1 for identical luminance to 21:1 for black against white. AA normal text needs 4.5:1 and large text needs 3:1. AAA normal text needs 7:1, AAA large text needs 4.5:1, and essential UI component contrast commonly uses 3:1.
The generated result is an implementation starting point, not a replacement for your component architecture. Put declarations in the selector that owns the visual treatment, and check whether existing styles override them. Where Tailwind output is offered, arbitrary values preserve the chosen numbers rather than silently approximating a built-in scale. Keep the full literal class in source so your framework can discover it during compilation.
Precision and real-world rendering
Values displayed by the interface may be rounded for readability. Browser rendering can still vary with available space, device pixel ratio, font metrics, and surrounding layout. Test the copied result inside its actual parent rather than assuming the isolated preview captures every constraint. If you need a shared design token, choose an intentional final value and document the purpose of that token alongside its syntax.
Pro tips
Threshold checks use the full unrounded ratio, even though the displayed value has two decimals. A displayed 4.50 is not a reason to round a failing value upward. The suggestion searches OKLab lightness while keeping colour axes fixed, then verifies the resulting sRGB hex; clipping may change its perceived hue.
Treat the preview as a fast comparison surface. A production review still needs real content, small screens, and the states people actually encounter.
- Keep an unmodified baseline so reviewers can compare the change against a familiar reference.
- Inspect the result at a narrow mobile width before polishing a spacious desktop layout.
- Prefer a small, named set of reusable decisions over many nearly identical one-off values.
- Check light and dark surfaces separately; a treatment that works on one is not automatically suitable for the other.
Common mistakes and practical use cases
A common mistake is copying a technically valid result without considering its job. Decorative treatments should support hierarchy rather than compete with labels, actions, or content. Test short and long content, and verify that the result remains understandable when the viewport changes. When a visual treatment carries meaning, provide a second cue such as clear text, position, or an explicit state label.
Another mistake is assuming a generated declaration belongs everywhere. Reuse should follow purpose: related cards may share a token, while a hero illustration can legitimately use a different treatment. Name decisions by their role when that makes future changes easier. Review hover, focus, disabled, and loading states where applicable, since those states often expose assumptions hidden by the default preview.
For deeper implementation context, read the related practical article. Pair this workflow with the contrast checker when foreground readability is involved, or explore the CSS grid generator to test the surrounding layout. The authoritative contrast ratio documentation explains the underlying syntax and browser behaviour in more detail.
Before shipping, paste the final output into the target component and compare it with the intended design at more than one viewport. Remove obsolete experiments, keep only the chosen result, and record any important assumptions. That small handoff step makes a quick visual experiment much easier to maintain as your product, content, and design system evolve.
Frequently asked questions
What does the wcag contrast checking tool do?+
Contrast ratio compares the relative luminance of two solid colours. It is one measurable part of accessible interface design, helping you evaluate body text, large headings, and essential visible component boundaries against WCAG thresholds.
How should I start using the controls?+
Enter Text colour and Background colour using hex values or the colour pickers. Use Swap colours to reverse their roles. Read the ratio and the five pass-or-fail tiles, then inspect the live heading, paragraph, and example control.
How should I interpret the generated result?+
Ratios range from 1:1 for identical luminance to 21:1 for black against white. AA normal text needs 4.5:1 and large text needs 3:1. AAA normal text needs 7:1, AAA large text needs 4.5:1, and essential UI component contrast commonly uses 3:1.
What should I check before production?+
Threshold checks use the full unrounded ratio, even though the displayed value has two decimals. A displayed 4.50 is not a reason to round a failing value upward. The suggestion searches OKLab lightness while keeping colour axes fixed, then verifies the resulting sRGB hex; clipping may change its perceived hue.
Does the preview replace testing in my project?+
No. The preview isolates the main effect, while your real layout introduces content, inheritance, responsive rules, and interaction states. Paste the output into its intended component and test narrow screens and accessibility requirements before shipping.
Articles that use this tool
In-depth articles with the Contrast checker built right in.
WCAG Compliance Checklist for Accessible Web Design
Audit contrast, keyboard access, forms, and responsive behavior with practical WCAG checks, accessible markup, and a repeatable issue-triage workflow.
Includes: Contrast checkerDark Mode Design: Color Choices and Contrast Ratios
Build a dark theme with clear surface hierarchy, measured text contrast, and preference-aware CSS that stays comfortable without sacrificing readability.
Includes: Contrast checkerButton Design: Primary, Secondary, Sizes and States
Build a clear button hierarchy with practical guidance on sizing, labels, icon placement, destructive actions, and state designs that do not shift layouts.
Includes: Contrast checkerEmpty State Design for First Use, No Results and Errors
Design empty states that explain what happened and offer the right next step, with distinct patterns for first use, filtered results, and failed requests.
Includes: Contrast checkerTabs vs Segmented Control: When to Use Each
Separate content navigation from value selection, then design tabs and segmented controls with clear labels, selected states, responsive layouts, and keyboard behavior.
Includes: Contrast checkerToast vs Banner vs Inline Alert: Notification UI Design
Choose the right notification surface for each event, write actionable messages, and design timing, placement and recovery states that keep people in control.
Includes: Contrast checker