Color Contrast Checker

Check foreground and background colors against WCAG contrast ratios for normal text, large text, and common interface states.

Readable text starts with enough contrast between the foreground and background.

Contrast ratio 14.68:1

Passes WCAG AA and AAA for normal text.

AA normal Pass

Needs 4.5:1

AAA normal Pass

Needs 7:1

AA large Pass

Needs 3:1

AAA large Pass

Needs 4.5:1

Suggested text color

#1f2937

How to use this color contrast checker

Use this checker before shipping text colors in a website, product UI, design system, email template, or brand asset where readability matters.

  1. Enter a text color and background color as hex, RGB, HSL, OKLCH, Lab, or a CSS color name.
  2. Choose whether you are checking normal text or large text.
  3. Review the contrast ratio and WCAG AA or AAA pass states.
  4. Apply the suggested text color when you need a quick accessible fallback.

Color Contrast Checker features

  • Check foreground and background colors against WCAG contrast thresholds.
  • Accept hex, RGB, HSL, OKLCH, Lab, and CSS color names.
  • Use text fields or color pickers for foreground and background colors.
  • Switch between normal text and large text requirements.
  • Preview readable sample text with the selected colors.
  • See AA and AAA pass or fail badges for the selected text size.
  • Generate an accessible suggested text color when the pair needs help.
  • Apply the suggested color directly to the checker.

WCAG contrast targets

WCAG contrast checks compare the relative luminance of text and its background. Normal text needs at least 4.5:1 for AA and 7:1 for AAA. Large text needs at least 3:1 for AA and 4.5:1 for AAA.

These targets are useful for designers choosing palette combinations, developers reviewing CSS, marketers checking campaign pages, and teams maintaining reusable components. A color pair that looks acceptable on one monitor can still fail for users with low vision, glare, older displays, or browser zoom.

When a brand color fails, start by changing the text color or the background behind the text instead of shrinking the text or relying on weight alone. Larger and bolder type can help, but body copy, button labels, form labels, and navigation usually need normal-text contrast.

How the contrast ratio is calculated

sRGB channel linearization
c_{linear} = \begin{cases} \frac{c_{srgb}}{12.92}, & c_{srgb} \le 0.04045 \\ \left(\frac{c_{srgb}+0.055}{1.055}\right)^{2.4}, & c_{srgb} > 0.04045 \end{cases}

Each red, green, and blue channel is first normalized from 0-255 to 0-1, then converted to linear light.

Relative luminance
L = 0.2126R + 0.7152G + 0.0722B

The green channel carries the most weight because human vision is more sensitive to green light.

Contrast ratio
\operatorname{Contrast} = \frac{L_{lighter} + 0.05}{L_{darker} + 0.05}

The resulting ratio is checked against 3:1, 4.5:1, and 7:1 WCAG text contrast thresholds.

The checker parses the colors in your browser, converts sRGB channels to linear light, calculates relative luminance, and divides the lighter luminance by the darker luminance with the WCAG contrast adjustment.

The suggested fallback chooses a readable foreground option for the current background. It is meant as a practical rescue color, not a full palette generator, so final visual decisions should still fit the surrounding interface and brand system.

The formula, 4.5:1 minimum, and large-text rules follow the W3C Web Accessibility Initiative's WCAG contrast technique. The 7:1 enhanced threshold follows its guidance for Contrast (Enhanced).

Color contrast checker FAQ

Does this upload my colors?
No. Color parsing and contrast calculations happen in your browser.
What counts as large text?
WCAG treats large text as 18pt or larger, or 14pt or larger when bold.
Should icons and UI borders use the same thresholds?
Text contrast thresholds are separate from non-text contrast requirements. This checker is focused on foreground text against a background.

Check contrast in the component's real state

Contrast ratio compares relative luminance after foreground and background colors are resolved. The ratio does not depend on hue names or personal preference. Small text generally needs a higher ratio than qualifying large text. The result here applies to the entered pair, so a different background, opacity, gradient position, or overlay creates a different result.

Use the rendered font size and weight when deciding whether text is “large.” CSS pixels, zoom, variable-font weights, and platform rendering can complicate a quick visual guess. When a design sits near a threshold, choose a more generous contrast rather than relying on a borderline classification. Thin letterforms can look weak even when the numeric ratio passes.

The WCAG 2.2 minimum contrast criterion defines requirements for text and images of text, along with exceptions. Non-text contrast separately covers visual information needed to identify controls, states, and graphical objects. Check both when reviewing a component.

Test every interactive state: default, hover, focus, active, selected, disabled, error, and visited where applicable. A button can pass at rest and fail when hovered. Placeholder text, helper text, validation messages, badges, and chart labels are easy to miss. Include dark and light themes rather than assuming one token mapping works in both.

For translucent colors, calculate the composited result over the actual layers. A semi-transparent white label can pass over one part of a photograph and disappear over another. Add a solid scrim, text background, outline, or different placement when imagery changes behind the text. Sampling one favorable pixel is not enough.

Do not use color as the only way to communicate status. Pair red or green with text, an icon, shape, pattern, or position that remains understandable for people with color-vision differences and on monochrome displays. The ratio can pass while two adjacent series or states are still hard to distinguish.

Automated checks cover only the values they can resolve. Canvas content, video captions, images of text, custom controls, and styles that change after interaction may require manual inspection. Test keyboard focus visibility and zoom, and include people using assistive technology when the product risk warrants it.

Save the tested pair with the design token names and component state, not just two hex values. Tokens can be remapped by theme, and a future change can break a previously passing component. Add automated contrast assertions where stable token relationships are part of the design system, then verify representative screens visually.

Production checklist

  • Enter the composited foreground and background from the rendered state, including opacity, overlays, gradients, and image regions.
  • Confirm actual font size and weight before applying a large-text threshold, and choose margin above a borderline ratio.
  • Check normal, hover, focus, active, selected, visited, disabled, error, and high-contrast states in every supported theme.
  • Review text, icons, control boundaries, focus indicators, charts, placeholders, helper text, and validation messages.
  • Provide a non-color cue for meaning and test zoom, keyboard navigation, forced colors, and common color-vision differences.
  • Test representative pages manually because automated tools can miss canvas, images of text, video, and interaction-driven styles.
  • Store passing token relationships in regression tests while retaining visual review for actual components.

Built and maintained by utilkit. Updated . Found an issue? Send corrections to contact@utilkit.com

Related Blog Posts

View all