Color Contrast Checker

Use HEX, rgb(), hsl(), hsv() or a CSS color name. Transparent text is blended with the background, and a transparent background with a white page.

Normal text at 16 px: The quick brown fox jumps over the lazy dog.

Large bold text at 19 px

Large text at 24 px

Button outline

Result

Contrast ratio

WCAG 2.2 results

CriterionRequiredResult
Normal text, AA4.5:1Pass
Normal text, AAA7:1Fail
Large text, AA3:1Pass
Large text, AAA4.5:1Pass
UI components and graphics, AA3:1Pass

The ratio is truncated, not rounded, to two decimals, so a color that fails a threshold never appears to reach it.

Nearest passing colors

Target ratio

Change the text color

Already reaches the target.

Change the background color

Already reaches the target.

Suggestions keep the hue, saturation and opacity and change only the HSL lightness, by the smallest step that reaches the target ratio.

APCA, the contrast method being developed for a future WCAG 3, weighs text size and polarity differently and can rate some color pairs very differently. It is not part of WCAG 2.2, so this tool reports only the WCAG 2.2 ratio.

Need to pick a color or convert HEX, RGB and HSL? Open the color picker

Processed locally in your browser. Your input is not uploaded or saved by this tool.

About this tool

This color contrast checker calculates the WCAG 2.2 contrast ratio between a text color and a background color and shows whether the pair passes level AA and AAA for normal text, large text and user interface components. A live preview shows the colors at real text sizes, and a swap button checks the reverse combination.

If a pair fails, the tool suggests the nearest text or background color that passes, changing only the lightness so the hue stays recognizable. Designers and developers use it to choose accessible brand colors, check buttons and links, and document design tokens. A share link keeps both colors.

How it works

Enter both colors in any CSS format or use the system color pickers. The ratio is (L1+0.05)/(L2+0.05)(L_1 + 0.05) / (L_2 + 0.05), where L1L_1 is the relative luminance of the lighter color and L2L_2 of the darker one. Relative luminance weights the linearized red, green and blue channels: L=0.2126R+0.7152G+0.0722BL = 0.2126 R + 0.7152 G + 0.0722 B. The ratio runs from 1:1 for identical colors to 21:1 for black on white.

WCAG 2.2 success criterion 1.4.3 (AA) requires 4.5:1 for normal text and 3:1 for large text, which means at least 24 px, or 18.66 px in bold. Criterion 1.4.6 (AAA) raises this to 7:1 and 4.5:1, and criterion 1.4.11 requires 3:1 for the visible parts of controls and meaningful graphics. The thresholds are exact, so 4.49:1 fails AA.

A translucent text color is first blended with the background, and a translucent background with a white page, because that is what appears on screen.

Example

Blue #3B82F6 text on white has a contrast ratio of 3.67:1. That passes AA for large text and for UI components (3:1), but fails AA for normal text (4.5:1) and both AAA levels.

With the AA 4.5:1 target, the tool suggests the slightly darker text color #1E6FF5 with 4.51:1, which keeps the hue and saturation and lowers the HSL lightness by about 6 percentage points. Alternatively, a dark background such as #1E1E1E would make the original blue reach 4.53:1.

Assumptions and limits

The tool implements the WCAG 2.x contrast formula for sRGB colors with 8 bits per channel. It does not check font weight, letter spacing or anti-aliasing, and it cannot judge text over images or gradients, where you should test the lightest and darkest parts. Logos and purely decorative text are exempt from the requirements. Suggestions change only HSL lightness and may not suit your palette. The checker is a design aid and does not replace a full accessibility review or testing with users.

Frequently asked questions

What contrast ratio does WCAG require?

For level AA, normal text needs at least 4.5:1, large text 3:1, and UI components and meaningful graphics 3:1. For level AAA, normal text needs 7:1 and large text 4.5:1. Most laws and accessibility policies refer to level AA.

What counts as large text?

WCAG defines large text as at least 18 point or 14 point bold. In CSS pixels that is about 24 px for regular text and 18.66 px for bold text. Smaller text, including most body copy and captions, needs the normal-text ratio.

Why does the tool show 4.49 when another checker shows 4.5?

Some checkers round the ratio to one or two decimals, which can turn 4.497:1 into 4.5:1 and wrongly show a pass. WCAG thresholds are exact, so this tool truncates the displayed value. If it shows 4.49:1, the pair fails AA for normal text.

How do I fix a color that fails?

Use the suggestions below the result. They darken or lighten the text or background color in the smallest step that reaches the chosen target while keeping the hue. Making text larger or bolder can also move it into the large-text category, which needs only 3:1.

What is APCA?

APCA (Accessible Perceptual Contrast Algorithm) is a newer contrast model proposed for WCAG 3. It accounts for text size, weight and whether light text is on a dark background. It is still a draft and not a legal requirement, so conformance today is measured with the WCAG 2.2 ratio shown here.

Link with your values

Add these parameters to this page’s address to open it with the values filled in, for example to share a calculation or to link to it from an AI assistant. The result is calculated in the browser: the page HTML shows an example for the default values, and the tool sets the data-url-params attribute once the link’s values are applied.

ParameterValueIf omitted
foregroundText colorcolour: hex without # (3b82f6) or a CSS namerequired
backgroundBackground colorcolour: hex without # (3b82f6) or a CSS namerequired
target_ratioTarget ratioone of: aa, aaa, largedefault aa

Examples

  • ?foreground=3b82f6&background=ffffff&target_ratio=aa
  • ?foreground=white&background=1e3a8a

Write decimals with a point. Encode a space as %20, + as %2B, # as %23 and & as %26.

Result elements: [data-result-block="contrast"][data-result-block="contrast-suggestions"]