Google Analytics helps us understand which tools you use and which actions work. Your files and entered text stay out of analytics.

WCAG contrast ratios: what passes, and what to test

Use the right threshold for the text size, then check the colours your page actually renders.

Free toolContrast CheckerCheck WCAG 2.2 colour ratios, preview text and copy AA, AAA and UI pass levels.Check your colours

What ratio do you need?

Normal text needs 4.5:1 for AA or 7:1 for AAA. Qualifying large text needs 3:1 or 4.5:1 respectively.

UseMinimumWCAG 2.2 criterion
Normal text, AA4.5:11.4.3 Contrast (Minimum)
Large text, AA3:11.4.3 Contrast (Minimum)
Normal text, AAA7:11.4.6 Contrast (Enhanced)
Large text, AAA4.5:11.4.6 Contrast (Enhanced)
Required UI and graphical information, AA3:1 against adjacent colours1.4.11 Non-text Contrast

The thresholds are inclusive. Exactly 4.5:1 passes AA normal text. A ratio of 4.499:1 fails, even if rounded to 4.50.

Passing these tests addresses contrast criteria only. Keyboard access, labels, structure, colour-independent cues and other requirements still apply.

What counts as large text?

Large text is at least 18 points regular or 14 points bold. In CSS pixels, that is 24px or about 18.667px.

ExampleWhich threshold?
16px regular body textNormal text
18px bold labelNormal text, below the bold size boundary
19px bold headingLarge text
24px regular headingLarge text

A heading tag alone does not make text large. Inspect the rendered font size and weight. Do not rely on zoom to qualify small text.

How is the contrast ratio calculated?

WCAG compares relative luminance after linearising sRGB channels. It is not a comparison of HSL lightness or raw RGB averages.

  1. Linearise each channel

    Scale RGB channels to 0 through 1. For a channel c at or below 0.04045, use c / 12.92. Otherwise use ((c + 0.055) / 1.055)2.4.

  2. Calculate luminance

    Use L = 0.2126R + 0.7152G + 0.0722B, where R, G and B are the linearised channels.

  3. Compare the pair

    Use (lighter L + 0.05) / (darker L + 0.05). Compare the full result with the threshold before rounding.

Black and white give 21:1. Identical colours give 1:1. Swapping the text and background colours does not change the mathematical ratio.

Why a barely different grey can change the result

#777777 fails AA normal text over white. #767676 passes. Each RGB channel differs by only one value out of 255.

Text over whiteCalculated ratioAA normal
#7777774.478089453577214:1Fail
#7676764.542224959605253:1Pass
#8888883.5448862152994005:1Fail

These synthetic examples were calculated with floi’s contrast module on 4 October 2026. They are reproducible in the contrast checker.

Aim for some room above the threshold. A mathematical pass close to the limit may still look weak with thin strokes.

Check transparency and image backgrounds at the rendered colour

Transparent text must be compared after compositing over the background. The source colour alone does not describe what you see.

For ordinary sRGB source-over blending on an opaque background, calculate each displayed channel as alpha × foreground + (1 − alpha) × background. Different blend modes or colour spaces need their actual rendering method.

SituationWhat to test
50% black over whiteThe resulting RGB channels are 127.5, not 0. Enter rgb(127.5 127.5 127.5) against white.
Text over a gradientFind the least contrasting region behind the text. A passing endpoint does not prove the whole line passes.
Text over a photoTest behind the actual glyphs across image crops and screen sizes. A solid background or overlay can make this more predictable.
Wide-gamut design colourTest the actual sRGB fallback if using this checker. A silently clipped P3 value may not be your intended colour.

floi’s checker refuses transparent and out-of-sRGB inputs. The colour converter helps inspect representations and clipping, but it is not a page sampler.

UI contrast needs the right neighbouring colour

Compare required boundaries, icons and state indicators with the colours immediately beside them. Text inside a control is checked separately.

A dark button label can pass against the button fill while its necessary outline fails against the page. Test both relevant pairs.

ElementRelevant checks
Input fieldText against the input fill; a boundary against the surrounding surface when needed to identify the field.
Selected checkboxThe mark or other required selected-state cue against its adjacent colour.
ChartGraphical information required to understand it. Add labels or patterns so colour is not the only cue.
Focus indicatorContrast with adjacent colours, alongside applicable focus visibility and appearance criteria.

Inactive controls have exceptions under text and non-text contrast criteria. Logotypes and incidental text also have specific text-contrast exceptions. Ordinary placeholder text is not automatically exempt.

Do not apply an exception merely because something looks decorative. Read the criterion and decide whether the information is required for the task.

How to test a real page

Use a colour-pair calculator for deliberate choices, then inspect the rendered page and interaction states.

  1. Inspect the actual styles

    Use browser developer tools to find computed colour, background, size and weight. Check inherited values and transparency.

  2. Check every relevant state

    Test default, hover, focus, selected and error states in both themes. Check mobile crops for text over images.

  3. Review beyond a scanner

    Run an accessibility scanner, then inspect image backgrounds and complex components manually. Automated coverage is incomplete.

MethodWhen to use it
floi Contrast CheckerOpaque sRGB colour pairs, modern colour notation and a copied report with explicit thresholds.
WebAIM Contrast CheckerIncludes a foreground alpha control, lightness adjustment and specialist links. These controls were inspected on 4 October 2026.
Coolors Contrast CheckerIncludes live previews and a Click to fix control. The interface was inspected on 4 October 2026.
WAVE browser extensionInvestigate a rendered page. Review automated results and complex backgrounds manually.

APCA is a separate method

APCA evaluates contrast differently and is explored in draft WCAG 3 work. Its scores are not WCAG 2 ratios.

Use WCAG 2.2 criteria when reporting WCAG 2 conformance. Do not label an APCA score as an AA or AAA pass.

Sources

The WCAG 2.2 relative luminance definition gives the formula. Understanding Contrast (Minimum) covers text size, thresholds and exceptions.

Understanding Non-text Contrast explains adjacency and required visual information. WCAG 3 is draft work, not a replacement conformance standard.

Frequently asked questions

Does every button need a 3:1 border?

No. WCAG 1.4.11 concerns visual information needed to identify the component or its state. A boundary is not always required. When a boundary is necessary, check its contrast against adjacent colours. Text inside the button has its own text-contrast requirement.

Can I use colour alone to show an error?

No. Passing a contrast check does not satisfy the separate requirement against using colour as the only visual means of conveying information. Add a clear error message or another cue, and make the error available to assistive technology.

Is a WCAG contrast pass a guarantee that everyone can read the text?

No. Contrast is one check. Font choice, weight, spacing, zoom, screen quality and individual vision still matter. Thin strokes may be difficult even with passing colour values. Give yourself a margin and test the actual text.

↑↓ move↵ openesc close