Colour contrast checker

Check a text and background colour against WCAG 2.2 AA and AAA. If they fail, you get the nearest colour that passes, keeping the same hue.

  • Colour
  • Runs in your browser. Nothing is uploaded

Large text, 24px

Normal body text at 16px. The quick brown fox jumps over the lazy dog, and this is how a paragraph of it reads.

ButtonSmall print, 13px

Contrast ratio

–

    Enter two colours

    WCAG contrast requirements

    CheckMinimum ratio
    AA normal text4.5:1
    AA large text3:1
    AAA normal text7:1
    AAA large text4.5:1
    UI components and graphics3:1

    Large text means at least 24px (18pt), or 18.66px (14pt) if bold. UI components covers things like input borders, focus rings, icons and chart lines that people need to see to use the page. Text in logos and disabled controls is exempt.

    Greys on white

    GreyRatio on whitePasses
    #9595952.99:1Nothing
    #7676764.54:1AA
    #5959597.00:1AAA
    #3d3d3d10.86:1AAA

    Getting to a pass

    When a pair fails, the checker suggests the closest text colour that passes, and the closest background colour, by changing only lightness in OKLCH. The hue and colourfulness stay the same, so your brand colour still looks like your brand colour, just a bit darker or lighter. Apply a suggestion with one click, and undo it if you change your mind.

    Traps the checker warns about

    • Rounding: a ratio between 4.45 and 4.5 shows as “4.5” in tools that round, but fails. The ratio here is always rounded down.
    • Transparency: rgba(0 0 0 / 50%) text has a very different contrast on white than on grey. It’s blended before measuring.
    • Placeholder text must meet 4.5:1 too, if it carries information.
    • Text on images or gradients needs to pass against the lightest part behind it.

    How the ratio is worked out

    ratio = (L1 + 0.05) / (L2 + 0.05)
    
    L = 0.2126 R + 0.7152 G + 0.0722 B    (relative luminance, linear RGB)
    L1 is the lighter colour, L2 the darker

    The ratio runs from 1:1 (identical colours) to 21:1 (black on white). Green contributes most to perceived brightness and blue least, which is why pure blue text on black is so hard to read.

    Need a colour in another format? Use the colour converter.

    Questions people ask

    What contrast ratio do I need?
    For WCAG 2.2 level AA: 4.5:1 for normal text, 3:1 for large text (24px, or 18.66px bold) and 3:1 for UI components like input borders and icons. Level AAA needs 7:1 for normal text and 4.5:1 for large text.
    My ratio is 4.49:1. Does that pass?
    No. WCAG doesn’t allow rounding up, so 4.49:1 fails AA for normal text. Some tools round to one decimal place and show 4.5:1, which is misleading. This checker never rounds up.
    What’s the lightest grey I can use on white?
    #767676, at 4.54:1, is the lightest grey that passes AA for normal text on white. #777777 just fails.
    How are transparent colours checked?
    A semi-transparent text colour is blended with the background first, then the contrast of the result is measured. A transparent background is blended with white, since that’s what usually sits behind it. The checker tells you when it has done this.
    What about APCA and WCAG 3?
    APCA is a newer contrast method being developed for a future WCAG 3. It models perception better, especially for dark mode, but it isn’t a standard yet and no law refers to it. For legal compliance (such as the Equality Act, the European Accessibility Act and the ADA), WCAG 2.2 ratios are still what count.
    ↑↓ move↵ openesc close