Colour contrast checker for WCAG 2.2

Enter a text colour and a background colour. The checker calculates the WCAG 2.2 contrast ratio and shows straight away whether it's enough for normal text (4.5:1), large text (3:1) and icons or controls (3:1). If a colour fails, we suggest the nearest colour that passes, keeping the hue as close as possible.

The calculation runs in your browser and needs JavaScript, which is switched off or blocked here. The thresholds below apply either way.

Hex, rgb(), hsl(), oklch() or a CSS colour name

Hex, rgb(), hsl(), oklch() or a CSS colour name

Large text starts at 24 px, or 18.66 px in bold.

Load an example

Result

Contrast ratio:

Result for each success criterion
WhatResultCriterionMinimum
Normal text 1.4.3 AA 4.5:1
Large text 1.4.3 AA 3:1
Normal text, enhanced 1.4.6 AAA 7:1
Large text, enhanced 1.4.6 AAA 4.5:1
Icons, borders, focus indicators 1.4.11 AA 3:1

Nearest passing colour

Adjust
    Simulate colour vision deficiency

    Simulation (an approximation): the average of each condition at full severity, after Machado et al. (2009). No person sees exactly this, and it is not a test criterion.

      As CSS

      Which thresholds apply?

      Which thresholds apply?
      WhatWCAG criterionLevelMinimum contrast
      Normal text1.4.3 Contrast (Minimum)AA4.5:1
      Large text (24 px+, or about 18.7 px+ bold)1.4.3AA3:1
      Icons, input borders, focus and state indicators, charts1.4.11 Non-text ContrastAA3:1
      Normal text, enhanced1.4.6 Contrast (Enhanced)AAA7:1
      Large text, enhanced1.4.6AAA4.5:1

      Level AA is the one that counts: EN 301 549 requires it, and that standard is what the BITV 2.0 rests on and what checks under the European Accessibility Act are usually measured against. AAA is a good target for body text, not a requirement.

      Large text in WCAG means at least 18 point, or 14 point bold. In a browser that's 24 CSS pixels, or roughly 18.7 CSS pixels at font-weight 700 or more. Enter size and weight and the checker applies the right threshold.

      Exempt are logos and brand names, purely decorative text, invisible text, and inactive controls such as a disabled button.

      How the contrast ratio is calculated

      It starts from each colour's relative luminance. Every channel (R, G, B) is divided by 255 and linearised: values up to 0.04045 are divided by 12.92; larger values become ((value + 0.055) / 1.055)^2.4. Luminance is then L = 0.2126 · R + 0.7152 · G + 0.0722 · B [1].

      The contrast ratio is (L1 + 0.05) / (L2 + 0.05), where L1 is the lighter colour. It ranges from 1:1 (same colour) to 21:1 (black on white).

      Don't round. WCAG says "at least 4.5:1". Grey #777777 on white is 4.478:1 – rounded to one decimal that reads 4.5, but it still fails. One step darker, #767676, reaches 4.54:1 and passes. Our checker shows two decimals and decides on the unrounded value.

      A link inside a paragraph has two jobs. It needs enough contrast with the background (4.5:1), and people must be able to tell it apart from the surrounding text without relying on colour (1.4.1 Use of Color).

      An underline is the simplest answer. If links are distinguished by colour alone, the W3C describes one sufficient approach: at least 3:1 between link and text colour, plus an extra cue on hover and keyboard focus (technique G183) [4].

      Example: blue #0066cc on white reaches 5.56:1 – fine. Next to dark grey body text #333333 it's only 2.26:1. Without an underline, many people won't see it's a link. Switch on "Check a link" to see both values at once.

      Non-text contrast: icons, inputs, focus

      Since WCAG 2.1, 3:1 also applies to anything you need to perceive to operate or understand a page:

      • Input borders, when the border is the only thing showing where to type. A light grey #cccccc border on white is 1.60:1 – for many people the field is invisible.
      • Icons without text – search, basket, close.
      • States – a ticked checkbox, the active tab, a toggle on or off.
      • Focus indicators – the outline that shows keyboard users where they are (2.4.7 Focus Visible).
      • Charts – lines, bars and areas needed to understand the data.

      Measure against the adjacent colour – usually the background, or the button itself for an icon inside a button.

      Find the nearest passing colour

      When a pair fails, the checker adjusts the lightness of your colour in the perceptually uniform OKLCH space [7], keeping hue and chroma as close as possible. Your brand orange stays orange: #ff8800 on white is 2.39:1. #ea7400 works for large text (3.00:1) and #c65300 for normal text (4.52:1). You choose whether to adjust the text or the background.

      Tip for design systems: give every brand colour a "text variant" that reaches 4.5:1 on white, and one for dark surfaces. Then nobody has to do the maths case by case.

      Simulate colour vision deficiency

      The preview shows your colours approximately as people with protanopia, deuteranopia, tritanopia or achromatopsia see them, after the model by Machado and colleagues [8]. It's a simulation, not a test criterion – useful for spotting where information relies on colour alone, like a red and a green status that look the same to many people.

      When a two-colour checker isn't enough

      A contrast checker compares two colours. On real pages, text sits on gradients, photos and semi-transparent layers, and hover or focus states only appear when you interact. Our free website accessibility checker measures the contrast of every piece of text on the rendered page. On the platform the check runs on a schedule across every page crawled – and where it can't be sure, such as text over an image, the spot goes into a separate list of "potential issues" instead of counting as a pass.

      Check contrast on a whole page See the WCAG 2.2 checklist

      Frequently asked questions

      What contrast ratio do I need for accessibility?

      At least 4.5:1 for normal text and 3:1 for large text (24 px, or about 18.7 px bold). Icons, control borders and focus indicators need 3:1. That's WCAG 2.2 level AA.

      Does placeholder text need to meet contrast?

      Yes – it's text, so 4.5:1. Better still, don't put important hints in a placeholder; it disappears as soon as someone types.

      Do disabled buttons need to pass?

      No. Inactive controls are exempt from 1.4.3 and 1.4.11. Still make it clear why a button isn't available.

      How do I check text on images or gradients?

      Measure at the worst spot – where the background is closest to the text colour. Safer: a semi-transparent layer behind the text, or a shadow that guarantees contrast everywhere.

      What about APCA and WCAG 3?

      APCA is a newer contrast model discussed in the WCAG 3 drafts. It isn't a normative benchmark yet. EN 301 549, the standard these laws are measured against, uses the WCAG 2 method used here.

      How does the checker handle transparency?

      A text colour with an alpha channel is composited over the background first – we measure the colour that's actually visible. A transparent background is laid over white, because the checker can't know what's underneath, and the result says when that has happened.

      Sources

      1. W3C: WCAG 2.2 – success criteria 1.4.3, 1.4.6, 1.4.11 and definitions of contrast ratio, relative luminance, large scale text – https://www.w3.org/TR/WCAG22/
      2. W3C: Understanding SC 1.4.3 Contrast (Minimum) – https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum.html
      3. W3C: Understanding SC 1.4.11 Non-text Contrast – https://www.w3.org/WAI/WCAG22/Understanding/non-text-contrast.html
      4. W3C: Technique G183 – https://www.w3.org/WAI/WCAG22/Techniques/general/G183
      5. W3C: Failure F73 – https://www.w3.org/WAI/WCAG22/Techniques/failures/F73
      6. ETSI EN 301 549 V3.2.1, clauses 9.1.4.3 and 9.1.4.11 – https://www.etsi.org/deliver/etsi_en/301500_301599/301549/03.02.01_60/en_301549v030201p.pdf
      7. Björn Ottosson: OKLab – https://bottosson.github.io/posts/oklab/
      8. Machado et al. (2009): CVD simulation model – https://www.inf.ufrgs.br/~oliveira/pubs_files/CVD_Simulation/CVD_Simulation.html

      See what a scan finds on your site

      One page in about thirty seconds, no email needed. The full report covers up to 100 pages and a keyboard journey.