DevTools Logo

Color Contrast Checker

Color Contrast Checker (WCAG AA/AAA)

Ensure your color combinations meet WCAG accessibility standards

Color Selection

Closest: white
Closest: black

    Examples

    White on black — the maximum contrast

    Input
    Foreground: #FFFFFF · Background: #000000
    Output
    Contrast ratio: 21:1
    AA: Pass · AAA: Pass

    The luminance difference between white and black yields the theoretical maximum of 21:1 — both WCAG AA and AAA pass for any text size.

    #777 on #FFF — a common subtle gray that fails AAA

    Input
    Foreground: #777777 · Background: #FFFFFF
    Output
    Contrast ratio: 4.48:1
    AA: Fail · AAA: Fail

    4.48 is below the 4.5 AA threshold for normal text, so gray text on white fails AA. Lighten the foreground or darken the background until the ratio is at least 4.5.

    Tailwind blue-500 on white — fails AA, OK for large text

    Input
    Foreground: #3B82F6 · Background: #FFFFFF
    Output
    Contrast ratio: 3.68:1
    AA Normal: Fail · AA Large: Pass

    3.68 is below the 4.5 normal-text threshold but above the 3.0 large-text threshold. Use the blue only for headings, buttons, or non-text UI elements.

    Accessible link blue on white

    Input
    Foreground: #0066CC · Background: #FFFFFF
    Output
    Contrast ratio: 5.57:1
    AA: Pass · AAA: Fail

    5.57 clears the 4.5 AA bar for normal text and is a safe choice for body links. The same color falls just short of AAA's 7:1 floor.

    About this tool

    The Color Contrast Checker measures the ratio between a text color and its background and reports pass or fail against WCAG AA and AAA thresholds. Enter both colors with the hex inputs or pickers, and the ratio — from 1:1 for identical colors up to 21:1 for black on white — updates alongside level badges and a live sample paragraph rendered in the actual pair.

    The maths is the WCAG relative-luminance method: each sRGB channel is linearized, weighted 0.2126, 0.7152 and 0.0722, and the lighter luminance plus 0.05 is divided by the darker plus 0.05. One ratio drives every verdict; the size context you select (normal, large, or UI components) only decides which thresholds apply.

    Because the ratio compares luminance, it can approve pairs that look muddy to real eyes. WCAG 3's draft APCA model replaces it with perceptual Lc values — try the APCA Contrast Calculator when you need the newer metric — and the built-in protanopia, deuteranopia and tritanopia previews show how the pair survives deficient vision.

    How to use this tool

    1. Choose both colors

      Type a hex value or use a picker for foreground and background; the nearest named color is shown.

    2. Set the size context

      Select normal text, large text, or UI components so the right thresholds apply.

    3. Read the verdict

      Weigh the ratio against the AA and AAA badges and the rendered sample text.

    4. Refine or export

      Swap the colors, try a random pair, then copy the analysis or export it as JSON.

    Use cases

    Auditing a design system

    Run every foreground/background pair from the design tokens through the checker and record the smallest ratio in each family so the design system ships only accessible combinations.

    Picking link and button colors

    Body copy needs a 4.5:1 ratio; interactive elements need 3:1 against the surrounding background. Use the checker to settle on a brand color that passes both.

    Validating a dark theme

    Pure white on pure black can feel harsh — explore #FFFFFF on #1F2937 (Tailwind slate-800) and similar dark-mode backgrounds to find a softer pair that still passes AAA.

    Diagnosing a "contrast is too low" Lighthouse warning

    Paste the offending colors into the checker, sort by size context, and confirm whether the fail is for normal text or only for the smaller copy where the threshold is stricter.

    WCAG thresholds this checker applies

    Content typeAA / AAA minimum
    Normal text (below 18pt, or 14pt bold)4.5:1 / 7:1
    Large text (18pt+, or 14pt bold+)3:1 / 4.5:1
    UI components and graphical objects3:1 / 4.5:1

    Success criteria 1.4.3 and 1.4.11; the UI Components preset follows the 3:1 non-text minimum.

    Common mistakes

    Mistake:Using a brand color for body text without first checking the ratio.

    Fix:Run the combination through the checker before shipping. Most primary brand colors fail WCAG AA on white — choose a darker shade or restrict the brand color to large headings and UI components.

    Mistake:Assuming large-text ratios apply to body copy.

    Fix:The 3:1 threshold applies only to text 18pt (24px) or 14pt bold (18.66px). Anything smaller needs 4.5:1 for AA and 7:1 for AAA, regardless of how visually prominent it looks.

    Mistake:Ignoring color-blindness and assuming visual contrast equals accessibility.

    Fix:Two colors that pass WCAG contrast can still be indistinguishable for someone with red-green color blindness. Enable the color-blindness simulation panel to preview the pair under protanopia, deuteranopia, and tritanopia.

    Mistake:Trusting the rounded 2-decimal ratio from the UI badges.

    Fix:The badges compare the live ratio against the threshold, but rounding errors can flip a near-miss — always read the displayed ratio and treat values within 0.1 of the threshold as marginal.

    Mistake:Checking once per asset and never again after a design change.

    Fix:Add a contrast check to the design-review checklist. A token swap that updates background or text color across the site is a single change but invalidates every pair that uses it.

    Frequently asked questions

    What contrast ratio does WCAG AA require?

    Level AA needs 4.5:1 for normal text and 3:1 for large text; the same 3:1 minimum covers UI components and graphical-object boundaries under criterion 1.4.11.

    What counts as large text?

    At least 18pt (24px), or 14pt — about 18.7px — when bold. Anything smaller is judged against the stricter normal-text ratios.

    Is APCA replacing the WCAG contrast ratio?

    Not yet. APCA is the proposed method for WCAG 3, which remains a draft, while WCAG 2.2 keeps the luminance ratio this tool computes. Check both when a design sits near a threshold.

    Do logos need to meet contrast requirements?

    No. WCAG exempts logotypes from its text-contrast criteria, along with purely decorative or inactive elements. Text inside a logo image is likewise exempt, though keeping wordmarks legible is still good practice.

    References & standards