vasilenko.info

WCAG color contrast checker

/en/tool/contrast-checker/ works Runs in the browser

Enter a text color and a background color. The tool will calculate contrast using WCAG 2, show which levels the pair passes, and find the nearest color that makes it pass. You’ll also see APCA from the WCAG 3 project, how the pair looks with color blindness, a grid of the entire palette, and an analysis of your CSS. Everything runs in the browser: no colors or files are sent anywhere.

promoTwenty years of notes on websitesHow we did it in 2008 and what still works today.Open

Color pair

The order of the colors does not affect the number: contrast is symmetric. The slider below the field changes lightness without affecting hue or saturation—the shortest way to bring a pair within the standard without losing its color.

The slider changes lightness HEX, rgb(), hsl(), hwb(), lab(), lch(), oklab(), oklch(), color(display-p3 …), a color name, or a complete string like --brand: #1a73e8 Could not parse the color. Example: #767676
The slider changes lightness A translucent background is composited with white Could not parse the color. Example: #FFFFFF
Dark theme
Preview
The heading and caption in the preview are calculated from it: ×1.5 and ×0.8
The preview will be placed over the image, and contrast will be calculated using its lightest and darkest areas. The file is read in the browser and is not uploaded anywhere.
Drag an image here

Large text, 24 px bold

Regular text, 16 px. Under WCAG, large text is 18 pt or larger, which is 24 px, and bold text is 14 pt or larger, which is approximately 18.7 px.

Small caption, 13 px — always regular text, with a threshold of 4.5.

Contrast ratio

:1

AA, regular text — 4.5 or higher
AA, large text — 3 or higher
AAA, regular text — 7 or higher
AAA, large text — 4.5 or higher
Icons and field borders — 3 or higher
Your font size and weight
APCA Lc — a WCAG 3 project
Text luminance, L
Background luminance, L

The calculation runs in your browser. Colors, the image, and CSS are not sent anywhere: you can verify this in the developer tools — there are no more requests after loading.

Closest passing color

The tool adjusts lightness in HSL without changing hue or saturation: the color stays the same, and only its lightness changes. This brings the pair up to the required level while keeping the brand recognizable.

Which threshold to reach

The threshold is selected above. The shift is shown in HSL lightness points — the percentage by which the color needs to be made darker or lighter.

APCA: what font size this pair can support

APCA is a contrast model from the WCAG 3 project. Unlike WCAG 2, it accounts for font size and weight and calculates dark text on light backgrounds differently from light text on dark backgrounds. It is not a standard yet: WCAG 2 is still required, and its results are shown above.

Lc value

Font size and weight supported by this pair
Font size

The thresholds in the table are APCA levels: Lc 90 for small body text, 75 for regular text, 60 for large text, 45 for headings, and 30 — the limit below which text should not be used at all. Weight shifts the threshold: 300 adds 15 points, 500 subtracts 5, 600 subtracts 10, and 700 subtracts 15. This is a simplified scale: the official APCA font-size lookup table still changes from version to version, while WCAG 2 remains the required standard.

How people with color vision deficiency see the pair

Brightness contrast changes very little with color vision deficiency — the color changes instead. If the pair relied on a red-versus-green difference rather than a lightness difference, it will collapse into two identical bands here, which is immediately visible.

Palette: all pairs at once

One pair at a time is a check. Designers need a grid showing which palette colors can be placed on top of each other and which cannot, regardless of font size. Each cell is filled with the actual pair, so you can see the grid instead of reading it.

Paste in colors to see a grid of all pairs.

An entire page, not just one pair

A page can contain hundreds of pairs, and no one checks them by hand. There are two ways to handle them here, and neither requires rewriting colors manually: the bookmarklet checks a live page directly in your browser, while the CSS parser finds issues in your source files.

The bookmarklet scans all visible elements with text, gets each element's computed text color and actual background—with all translucent layers and inherited styles—compares them against thresholds based on font size and saturation, and outlines failures directly on the page. It works on any site, including password-protected and local sites, because the checks run in your browser, not on our server.

Page contrast
  1. Drag the “Page contrast” button to your browser's bookmarks bar. If the bar is hidden, press Ctrl + Shift + B, or Cmd + Shift + B on a Mac.

  2. Open your page and click the bookmarklet. A list of pairs that fail AA will appear, and the failures will be outlined on the page.

  3. Each row in the list links here with its pair already filled in: click it to immediately find the nearest passing color.

You can click the bookmarklet right here: it will check this page and show what it finds. On pages that block third-party scripts with a strict security policy, the bookmarklet will not run—use the CSS parser below instead.

Drag a .css or .html file here

The parser looks for rules in the form “selector { declarations }”: it reads color and background declarations and substitutes var(…). A rule that defines only the text color is checked against the page background—the value set on body or html, or white if neither has one.

Get result

A text report for email and tracker tickets. CSS to add the pair to your project as variables. JSON to run the pairs through your own check during the build.

pair variables ready-to-use CSS
check result JSON
promoCalculate ROI at the same timeCampaign payback based on spend and revenue.Open

How to use it

  1. Enter the text color and background color in any of these formats: #RRGGBB, rgb(), hsl(), hwb(), lab(), lch(), oklab(), oklch(), color(display-p3 …), or an English color name. You can paste a complete line from your code—“--brand: #1a73e8;” will be parsed just like a bare color.

  2. Do not focus on the number itself; look at the threshold rows: 4.5 is the boundary for regular text, while 3 is the boundary for large text and non-text elements. The “your font size and weight” row answers the question for the text you entered in the sample.

  3. If the pair fails, move the lightness slider below the field: the label below it shows the values at which the pair starts passing AA and AAA. The answer is already calculated in the “Nearest passing color” section, which also has a button to apply it.

  4. Check text on a photo using an image: select a file in the “Sample” block, and the tool will find the lightest and darkest areas and calculate both pairs. The worse pair must pass.

  5. Enable dark mode with the “Check the second pair” checkbox: inversion almost never preserves contrast, and both pairs must pass at the same time.

  6. Check the entire palette with the grid: paste a list of colors, and a matrix of all pairs with pass/fail marks will appear. You can send the grid link in a chat—the state is stored in the URL.

  7. Check an entire page with the bookmarklet in the “Entire page” section: it scans the live document in your browser. If you need to analyze the source files, drag a stylesheet file there.

promoBrowser task listNo account required—everything is stored on your device.Open

The formula and what it includes

Contrast = (L of the lighter color + 0.05) ÷ (L of the darker color + 0.05)

The standard is WCAG 2, which is used to calculate the main number. APCA from the WCAG 3 project is calculated in a separate section alongside it: it describes the readability of small and light text more accurately, but it is not yet a standard, so it cannot be cited in requirements.

Example breakdown: black text on a white background

The input data is the same as the default field values: you can calculate it mentally and confirm that the tool is telling the truth.

  1. White: each channel is 255, which becomes 1 after division by 255, and linearization does not change 1.

  2. White luminance: L = 0.2126 + 0.7152 + 0.0722 = 1.

  3. Black: each channel is 0, so L = 0.

  4. Put the light color on top: (1 + 0.05) ÷ (0 + 0.05).

1.05 ÷ 0.05 = 21. A contrast ratio of 21:1 is the maximum possible in sRGB. It passes all levels. APCA gives Lc 106 for the same pair—the maximum on its own scale, whose limit is around 108.

Frequently asked questions

promoAll toolsForty-four tools, all running in your browser.Open

Related tools

5