WCAG Colour Contrast Checker

Check the contrast ratio between text and background colours against WCAG 2.x AA and AAA accessibility requirements, with a suggested accessible colour.

Updated · Free · Runs in your browser

Contrast ratio —
AA normal text —
AA large text & UI —
AAA normal text —
AAA large text —
Colours —
Accessible alternative —
    Was this calculator helpful?

    The formula

    Relative luminance L = 0.2126 R + 0.7152 G + 0.0722 B, using linearised sRGB channels
    Linearise: c ≤ 0.04045 → c ÷ 12.92, otherwise ((c + 0.055) ÷ 1.055)^2.4
    Contrast ratio = (L_lighter + 0.05) ÷ (L_darker + 0.05), from 1:1 to 21:1
    WCAG 2.x: AA 4.5:1 (normal text), 3:1 (large text, UI); AAA 7:1 (normal), 4.5:1 (large)

    Worked example

    1. Grey text #6B7280 on white #FFFFFF:
    2. The grey's relative luminance is 0.1672; white's is 1.0.
    3. Ratio = (1.0 + 0.05) ÷ (0.1672 + 0.05) = 4.83:1.
    4. That passes AA for normal and large text, but fails AAA for normal text, which needs 7:1.

    Why colour contrast matters

    Text needs enough contrast against its background to be readable by everyone, including the hundreds of millions of people with low vision or colour vision deficiencies, older users, and anyone reading on a phone in sunlight. The Web Content Accessibility Guidelines (WCAG) set measurable contrast thresholds, and they're referenced by accessibility laws and standards around the world, including the Americans with Disabilities Act case law, Section 508 in the US, the European Accessibility Act and EN 301 549. Checking contrast early in design is much cheaper than fixing it later.

    How the contrast ratio is calculated

    WCAG defines contrast using relative luminance, a measure of perceived brightness. Each sRGB channel is converted to a linear light value, then weighted by how sensitive the eye is to it: green contributes most and blue least. The contrast ratio compares the luminance of the lighter colour to the darker one, with 0.05 added to each to account for screen glare. The result ranges from 1:1, for identical colours, to 21:1, for black on white. The order of the colours doesn't matter.

    AA and AAA requirements

    Level AA, the target for most websites and the level usually required by law, needs a ratio of at least 4.5:1 for normal text and 3:1 for large text. Large text means at least 18 point (24px) regular or 14 point (about 18.7px) bold. WCAG 2.1 added a 3:1 requirement for user interface components and meaningful graphics, such as form field borders, focus indicators and icons. Level AAA raises the text thresholds to 7:1 and 4.5:1. Logos and purely decorative text are exempt.

    Fixing low contrast

    If your colours fail, darken the text or lighten the background, or vice versa for dark themes. The calculator suggests a version of your text colour, moved towards black or white, that reaches 4.5:1 while keeping its hue as far as possible. Light grey placeholder text, text over images and brand colours such as light blues, yellows and oranges are common problem areas. For text over photos, add a solid or semi-transparent overlay behind the text and check the contrast against the darkest and lightest parts of the image.

    Beyond the contrast ratio

    Contrast is necessary but not sufficient for readability. Don't use colour alone to convey meaning, such as red for errors, without an icon or text label. Thin, small fonts need more contrast than the minimum suggests. WCAG 3, still in development, is expected to use a newer perceptual contrast model (APCA) that accounts for font size and weight, but WCAG 2.x ratios remain the legal and practical standard today. Test your designs in dark mode too, and with browser zoom.

    Dark mode

    Dark themes need the same contrast ratios, but pure white text on pure black (21:1) can cause halation, a glowing effect, for some readers, especially people with astigmatism. Many design systems use off-white text such as #E5E7EB on a dark grey like #111827, which still gives a ratio of about 14:1 while being easier on the eyes. Check every colour pair in both themes, including links, disabled states and placeholder text.

    For accessible typography, combine sufficient contrast with sensible sizes: our px to rem converter helps you size text in scalable units, and the typography scale calculator builds a consistent set of heading sizes. For print work, check image resolution with the DPI calculator, and for readability of the words themselves, the readability score calculator.

    Frequently asked questions

    What is a good contrast ratio?
    At least 4.5:1 for normal body text (WCAG AA) and 3:1 for large text and UI components. 7:1 meets the stricter AAA level.
    Does #777777 on white pass WCAG?
    Narrowly no for normal text: its ratio is 4.47:1, just under 4.5:1. #767676 is the lightest grey that passes AA on white, at 4.54:1.
    What counts as large text in WCAG?
    Text at least 18pt (24px) in regular weight, or at least 14pt (about 18.66px) bold.
    Does the order of colours matter?
    No. The ratio is always the lighter luminance over the darker one, so swapping text and background colours gives the same result.
    Do logos need to meet contrast requirements?
    No. WCAG exempts text that's part of a logo or brand name, and purely decorative text that conveys no information.

    ↑↓ to navigate · Enter to open