Color Contrast Checker

Check the WCAG 2.x contrast ratio of text and background colours, with pass or fail for text, large text and UI components. Your colours never leave your browser.

Hex (#rgb, #rrggbb, #rrggbbaa), rgb(), rgba(), hsl(), hsla() with commas or spaces, or a CSS colour name. The pickers set opaque colours.

Type or pick two colours. Nothing you enter leaves your browser.

Contrast ratio

–

WCAG 2.x, shown to two decimals by truncation: a value is never rounded up to a pass.

WCAG 2.x checks for this pair
CheckResultNeedsMargin
Normal text, AA (1.4.3)4.5:1
Normal text, AAA (1.4.6)7:1
Large text, AA (1.4.3)3:1
Large text, AAA (1.4.6)4.5:1
UI components and graphics, AA (1.4.11)3:1

Preview

Contrast against black and white

Foreground on #000000
–
Foreground on #ffffff
–

Suggest the nearest passing colour

Keeps the colour's hue and saturation and changes only its HSL lightness, in 0.1% steps, to the nearest value that reaches the target; each suggestion is checked again with the same ratio function before it is shown.

Change the foreground

Change the background

The colours used

ColourHexRGBHSL
Foreground
Background

Is my text large?

Large text is at least 24 px (18pt) regular or 18.66 px (14pt) bold.

Colour contrast is the difference in brightness between text and the colour behind it. Too little makes text hard to read, for people with low vision and for anyone on a dim or glaring screen. WCAG, the Web Content Accessibility Guidelines, measures it as a ratio from 1:1 to 21:1, black on white.

The WCAG formula

WCAG 2.x defines the contrast ratio of two colours as (L1 + 0.05) / (L2 + 0.05), where L1 is the relative luminance of the lighter colour and L2 of the darker. Relative luminance is 0.2126 R + 0.7152 G + 0.0722 B, after each sRGB channel c, as a fraction from 0 to 1, is linearised: c / 12.92 if c is at most 0.04045, otherwise ((c + 0.055) / 1.055) ^ 2.4. The tool uses 0.04045, the value in the current WCAG 2.x text; older copies say 0.03928, which gives the same result for every 8-bit colour.

A worked example, #767676 on #ffffff: each channel of #767676 is 118, or 0.4627 as a fraction, which linearises to 0.1812, its luminance. White's is 1. The ratio is (1 + 0.05) / (0.1812 + 0.05) = 4.54:1, just above 4.5:1. One step lighter, #777777 on white gives 4.47:1 and fails.

The thresholds

Normal text needs at least 4.5:1 for level AA and 7:1 for level AAA. Large text needs 3:1 for AA and 4.5:1 for AAA; it means at least 24 CSS px (18pt) regular, or 18.66 CSS px (14pt) bold. User interface components and graphical objects, such as an input's border or an icon that carries meaning, need 3:1 against the colours next to them (success criterion 1.4.11, level AA).

WCAG says nothing about rounding, so the tool never rounds up: it truncates to two decimals, and 4.4999:1 shows as 4.49:1 and fails 4.5:1.

Transparency

A colour with transparency is blended over what is behind it with straight alpha compositing in sRGB: each channel is top × alpha + behind × (1 − alpha), rounded to a whole value. The foreground is blended over the background, and a transparent background over the page behind it, white unless you change it. The tool shows the opaque colour it used.

What the tool does not check

It checks one pair of flat colours, not text over images or gradients, hover and focus states, disabled controls or logos; WCAG exempts some of these, and the rest need manual review. A passing ratio is necessary for many criteria but not sufficient: it does not make a page accessible.

Privacy

The colours you enter are processed in your browser and never leave it. Like every page on this site, the page records a visit when it loads, but not the colours you type.

How to use

  1. Type or pick a foreground (text) colour and a background colour.
  2. Read the ratio and the five checks; they update as you type.
  3. If a check fails, use a suggested colour, then copy the result.

Features

Common uses

Frequently asked questions

What is a good contrast ratio?

For WCAG level AA, 4.5:1 for normal text and 3:1 for large text and UI components; level AAA asks for 7:1 and 4.5:1.

What is the WCAG contrast ratio formula?

(L1 + 0.05) / (L2 + 0.05), with L1 and L2 the relative luminances of the lighter and darker colour; see the worked example above.

What counts as large text?

At least 24 CSS px (18pt) regular, or 18.66 CSS px (14pt) bold.

Do I need 4.5:1 for icons and buttons?

Not for their shapes: a meaningful icon, or a control's border, needs 3:1. Button text needs 4.5:1, or 3:1 if it is large.

Why does my ratio differ from another checker?

Usually rounding: many checkers round 4.478 to 4.48, while this tool truncates it to 4.47. Checkers also handle transparency differently.

Is APCA the same as WCAG contrast?

No. APCA is a different, proposed method of measuring contrast; it is not part of WCAG 2.x, which remains the standard that most laws and tests refer to. This tool checks WCAG 2.x only.

Are my colours uploaded?

No. They are processed in your browser and never sent anywhere or saved. The page itself records a visit when it loads, as every page here does.

Need to test a whole website, not just a snippet?

RoboQA tests real pages and user journeys in a browser: logins, forms, clicks and full flows. See what RoboQA can test or compare plans.

More free tools

See all free tools