Contrast Checker: Read WCAG and APCA Ratios, Then Fix the Pair
A contrast checker turns a visual judgment into a repeatable number. You enter a foreground color and a background color, and the tool compares their relative luminance, reports a ratio, and tells you whether the pair passes the rule you are working to. That is the whole job in one sentence, but the details are where most accessibility reviews go wrong.
The Color Contrast Checker on this page handles the usual WCAG 2.0, 2.1, and 2.2 checks and adds a signed APCA Lc score beside them. It also shows a preview of real interface pieces, suggests a passing replacement when a pair fails, and can compare every pair in a small palette. This guide explains what the numbers mean, which threshold applies to which text, and how to use the checker without overstating what an APCA score proves.
What a contrast checker measures
A contrast checker does not compare hue. It compares relative luminance, the amount of light a color produces after the red, green, and blue channels are linearized. For an sRGB color, the WCAG definition weights the channels like this:
$$L = 0.2126R + 0.7152G + 0.0722B$$
Green carries most of the weight because human vision is more sensitive to it. That is why a saturated blue can look strong against white while a mid-gray with a similar RGB distance can fail. The ratio then puts the lighter luminance over the darker one:
$$CR = \frac{L_{light} + 0.05}{L_{dark} + 0.05}$$
The result runs from 1:1, where the two colors are identical, to 21:1 for black on white. The 0.05 term accounts for viewing flare, so the formula never divides by zero. Two different colors can land on the same ratio if their luminance is the same, and a color that looks bright on one monitor can measure differently on another. The calculation is about the color values, not the appearance of a particular screen.
This is also why a checker should show the pair, not just the foreground. White text is readable on a dark navy background and unreadable on a pale yellow one. The same white has two different results. The Color Contrast Checker keeps foreground, background, and link colors separate, composites alpha where needed, and reports the pair that will actually be judged.
The ratio is a useful first filter, not a complete accessibility review. It does not know whether the text is a logo, whether the element is disabled, or whether a gradient sits behind it. Those exceptions are in the WCAG text, and the checker gives you the measurement you need to apply them.
The WCAG thresholds that matter
WCAG 2.2 Level AA requires a contrast ratio of at least 4.5:1 for normal text and 3:1 for large text. Large text means 24 CSS pixels or larger at a normal weight, or 18.66 CSS pixels or larger when bold. The same document explains that 18 point and 14 point bold are the print equivalents. Those are thresholds, not suggestions, and the ratio is compared without rounding: a computed 4.499:1 does not meet 4.5:1.
Level AAA raises the text targets to 7:1 for normal text and 4.5:1 for large text. It is a stricter goal for long-form reading, not a requirement that every paragraph on every site must meet. WCAG 2.1 added a separate 3:1 requirement for visual information needed to identify user interface components and meaningful graphics. WCAG 2.2 keeps both sets of numbers; the contrast ratios did not change in the newer version.
| Text or element | AA | AAA | Typical example |
|---|---|---|---|
| Normal text below large-text size | 4.5:1 | 7:1 | Body copy, labels, captions |
| Large text: 24px regular or 18.66px bold | 3:1 | 4.5:1 | Headlines, hero copy |
| UI components and meaningful graphics | 3:1 | Not defined | Borders, icons, focus rings |
Two details cause most of the arguments. First, large text is a size and weight rule, not a typeface rule. A thin 24px font can be harder to read than the ratio suggests, while the WCAG threshold remains 3:1. Second, the 3:1 non-text rule is about the part of a component needed to identify it, such as a border, icon, or focus indicator. It is not a free pass for pale gray body text. The checker shows a UI components card only for WCAG 2.1 and 2.2, because that requirement is not part of the 2.0 text criterion.
The link check is a separate decision. When a link is distinguished from surrounding text by color alone, the link color needs at least 3:1 against that surrounding text, not merely against the page background. This checker compares the link color with the foreground text for that reason. It also keeps the main foreground-background ratio as the headline number, so the two questions do not get mixed together.
How the checker applies a version and a target
The version selector is not cosmetic. In WCAG 2.0 mode, the checker reports AA and AAA results for normal and large text, plus link contrast, and leaves the non-text UI check out of the result. Switch to 2.1 or 2.2 and the UI components card appears. That matches the way the criteria were introduced, and it prevents a 2.0 audit from claiming a non-text requirement that did not exist in that version.
The size and weight fields decide whether a pair is treated as normal or large text. The tool uses 24px as the regular-text boundary and 18.66px at weight 700 or above, which is the practical translation of 18pt and 14pt bold. You can enter a size in pixels or points. The point conversion uses the CSS ratio of 96 pixels to 72 points, so the result follows the same unit definition a browser uses.
The target menu controls the fix panel and the palette matrix. Choose AA normal 4.5:1 for body copy, AA large and UI 3:1 for headings and controls, AAA normal 7:1 for the strict case, or AAA large 4.5:1 for large headings. The four AA and AAA cards always show the full picture, while the selected target decides what counts as a failure when the checker proposes a replacement. That separation is useful: you can see that a pair passes AA large but still fails the 4.5:1 target you selected for body text.
The ratio readout keeps two decimals for readability, but the comparison uses the unrounded value. This is the right behavior for WCAG. A tool that rounds first can turn a 4.48 into a passing 4.5, and the page then ships with a pair that fails the actual criterion. The checker also reports the APCA score separately instead of folding it into the WCAG badges. The two models answer related questions, but they are not interchangeable.
What APCA Lc adds, and what it does not
APCA stands for the Accessible Perceptual Contrast Algorithm. It reports a signed lightness contrast value, Lc, rather than a ratio. A positive Lc means dark text on a light background; a negative Lc means light text on a dark background. The sign carries polarity information that the WCAG ratio does not: black on white and white on black both measure 21:1 under WCAG, while APCA treats the two directions differently.
The checker compares the absolute Lc value with a threshold you choose. The menu offers 15, 30, 45, 60, 75, and 90, and the APCA size and weight lookup shows the minimum font size for each weight at those levels. In general, higher values are for smaller or more important text. APCA guidance describes Lc 90 as a preferred level for body text and Lc 60 as a minimum for content text, while larger or heavier text can work at lower levels. The checker exposes the values; the right one still depends on the job.
APCA is not part of WCAG 2.2 conformance. A site cannot claim WCAG 2.2 AA because it has a good APCA score, and it should not treat a low APCA score as proof of a WCAG failure. The useful move is to read both numbers together. A pair that passes WCAG but has a weak APCA score in dark mode may deserve another look, especially for thin fonts and small text. A pair that fails WCAG but has a strong APCA score still needs a WCAG decision if the project is aiming at WCAG conformance.
The checker's APCA panel also includes a lookup table for weights 100 through 900. The table uses the official APCA implementation, not a hand-built curve. That matters because APCA scores are sensitive to polarity and font weight, and a simplified approximation can make a dark-mode pair look safer than it is. Use the table as a starting point, then test the actual typeface and size in the preview.
Why two checkers can disagree
If two WCAG checkers return different ratios for the same opaque sRGB pair, one of them is probably rounding, parsing a different color, or using a different text-size rule. The arithmetic is deterministic. The common sources of disagreement are worth knowing before you file a bug.
- Rounding. A checker that displays 4.5 may have computed 4.499 or 4.48. The unrounded value decides the pass.
- Alpha. A translucent color has no single visible value until it is composited with what is behind it. The checker composites a translucent background over white, then a translucent foreground over that result. A page with a gradient or photograph can produce a different visible color.
- Color space. Modern CSS colors such as oklch() and display-p3() are converted to sRGB for the WCAG calculation. The converted hex can differ from the token you authored, especially outside the sRGB gamut.
- Large-text definition. A tool may use 18pt, 24px, or 18.66px bold with slightly different boundaries. This checker uses 24px regular and 18.66px at weight 700 or above.
- Different models. An APCA Lc score is not a WCAG ratio. Comparing the two as if they were the same scale will always look like a disagreement.
For a clean comparison, use the same foreground, background, alpha, version, text size, and weight. Then check the unrounded ratio. If the pair sits within a hundredth of a threshold, test the actual values rather than trusting a rounded display.
Transparency deserves its own warning. The checker has to turn an alpha value into an opaque pair before it can calculate luminance. It uses white as the base for a translucent background. If your design places a 40% black panel over a photograph, the visible result depends on the photo, not on white. Sample the final pixels or use an opaque stand-in that matches the area behind the text. The same rule applies to text over gradients and to colored overlays.
A workflow that fixes the pair
Start with the pair that actually appears together. Enter the foreground and background, then add the link color if links are distinguished by color alone. The six presets are useful for sanity checks: white on black, black on white, navy on white, yellow on black, gray on white, and blue on light. They are starting points, not a claim that every preset passes every target.
Next, choose the version, size, weight, and target before reading the badges. A ratio without a target is just a number. If the text is 16px body copy, 4.5:1 is the relevant AA threshold. If it is a 28px heading, 3:1 may be enough for AA large, but the same pair can still fail the 4.5:1 target you use for body text. The checker keeps these results visible at once so you can see which rule is failing.
When the pair fails, open the fix panel. The checker proposes a foreground color and a background color that meet the selected target, and it tells you when the target is impossible on the current background. That can happen when even pure black or pure white cannot reach the requested ratio against a mid-tone background. In that case, change the background or move to a lower target rather than forcing a color that cannot work.
Apply a suggestion and inspect the preview. The preview includes small text, body text, large text, a filled button, an outline button, an input, a focus ring, and links. This is where a mathematically passing pair can still look wrong: a color that passes 4.5:1 may be too close to the brand hue, or a focus ring may disappear against the button fill. The undo button restores the previous colors in one step.
The nearest Tailwind list is helpful when the replacement has to live inside a design system. It sorts passing colors by CIEDE2000 distance from the current foreground, so the first entries are the closest passing alternatives rather than an arbitrary palette. Apply one and check the preview again. The list is a convenience, not a requirement; a custom hex that passes is just as valid.
Checking a whole palette
For a whole palette, open the matrix. Add between two and eight colors, and the checker compares every foreground and background pair. Filter to passing or failing cells, then export the matrix as CSV or Markdown. The CSV keeps the foreground, background, ratio, pass flag, and target for each pair. The Markdown export gives you a table you can paste into a review. Saved pairs stay in the browser, up to 20, and a share link restores the current colors and settings. The link does not carry the palette or the saved list.
Where the checker stops
This is a pair checker, not a site crawler. It does not accept a URL, upload a screenshot, or scan a PDF. It cannot see a gradient, a photograph, a hover color that appears only after a pointer event, or a disabled state that the page applies with a class. You have to bring the actual colors and check the states that matter.
The palette matrix is limited to eight colors, which is enough for a token set but not for a full design system. Saved pairs and recent colors live in local storage, so they are tied to the browser and can disappear when site data is cleared. The share link preserves the active colors and settings, not the palette or the saved library.
APCA is shown as an additional score. It does not convert the page into a WCAG 2.2 conformance claim, and the WCAG badges do not become an APCA certification. Use the checker to make a color decision and document the numbers; use a page-level audit for the rest of the accessibility review.
Frequently Asked Questions
Is 4.5:1 enough for large text?
Not necessarily. Large text has a lower AA threshold of 3:1, so a pair at 3.2:1 can pass AA large while failing AA normal. AAA large is 4.5:1. Choose the target by the text's role, not by the largest number you can find.
Why does the ratio change when I add alpha?
Alpha has no visible color until it is composited with something behind it. The checker uses white as the base for a translucent background and then places the foreground over the result. If the real page has an image or a different panel color behind the text, the visible pair is different.
Is APCA better than WCAG?
They answer different questions. WCAG gives a testable conformance ratio; APCA models perceived lightness contrast with polarity and font weight. APCA is not part of WCAG 2.2, so it cannot replace the WCAG check for a project that must meet WCAG. It can still reveal a weak dark-mode or thin-text pair that the ratio alone hides.
Can I check hover and focus states?
You can check the colors you enter, and the preview includes a focus ring and links. The checker does not trigger a page's hover or focus styles automatically. Capture the actual colors from those states, then test each pair separately.
What does "target not reachable" mean?
It means the maximum possible contrast for black or white against the current background is below the selected target. No foreground color can reach that ratio on that background. Change the background or choose a target that the background can support.
Does the checker store my colors?
Recent colors and saved pairs are stored in this browser's local storage. The color calculations run on your device. A share link puts the active colors and settings in the URL fragment, so treat the link as you would any other shared design detail.
France · SO reputation 7983 · Badges: 2🥇17🥈15🥉 · SO member since 2013