WCAG Color Contrast: Ratio Formula, Thresholds and States
For ordinary text, WCAG 2.2 Level AA requires a contrast ratio of at least 4.5:1 between the text color and the background behind it (SC 1.4.3). Large-scale text needs 3:1. Level AAA raises those to 7:1 and 4.5:1 (SC 1.4.6). Icons, control boundaries, focus indicators and meaningful chart shapes need 3:1 against adjacent colors at Level AA (SC 1.4.11). The ratio is exact arithmetic on sRGB values, with no rounding: 4.499:1 fails.
Calculate a color pair
WCAG contrast calculator
The result uses the WCAG relative-luminance formula and reports both text thresholds. Pass/fail comparisons use the full calculated value; only the displayed ratio is rounded. Inputs stay in your browser. For a transparent color, gradient or image background, first determine the actual adjacent colors and evaluate the least favorable combination behind the content.
Quick facts
| Question | Answer |
|---|---|
| Normal text, Level AA (1.4.3) | 4.5:1 |
| Large-scale text, Level AA (1.4.3) | 3:1 |
| Normal text, Level AAA (1.4.6) | 7:1 |
| Large-scale text, Level AAA (1.4.6) | 4.5:1 |
| UI components, states and graphics, Level AA (1.4.11) | 3:1 against adjacent color(s) |
| Range of possible ratios | 1:1 (identical colors) to 21:1 (black on white) |
| Rounding | Not allowed: 4.499:1 does not meet 4.5:1, and 2.999:1 does not meet 3:1 |
| Large-scale text | At least 18 point, or at least 14 point bold |
| Status of APCA | Not part of WCAG 2.2; not named in the WCAG 3.0 Working Draft of 10 September 2026, whose contrast algorithm is “yet to be determined” |
The two formulas, exactly as WCAG states them
The WCAG 2.2 definition of relative luminance works on the sRGB color space. Take each 8-bit channel value, divide by 255 to get RsRGB, GsRGB or BsRGB, then convert each to a linear value:
- if the channel is 0.04045 or less, the linear value is the channel divided by 12.92;
- otherwise it is
((channel + 0.055) / 1.055) ^ 2.4.
Relative luminance is then L = 0.2126 * R + 0.7152 * G + 0.0722 * B, a number from 0 (darkest black) to 1 (lightest white).
The contrast ratio is (L1 + 0.05) / (L2 + 0.05), where L1 is the luminance of the lighter color and L2 of the darker. Because the lighter color is always L1, the order in which you enter the two colors never matters.
Before May 2021 the definition used 0.03928 as the threshold, a value taken from an older version of the specification, so older code and copies of the formula may show that number. WCAG 2.2 states 0.04045 and notes that the change “has no practical effect on the calculations in the context of these guidelines.” For 8-bit colors the two thresholds give identical results, because no channel value divided by 255 falls between them: 10/255 is 0.0392 and 11/255 is 0.0431.
Worked example: #767676 on white
- Hexadecimal
76is 118 in decimal. 118 / 255 = 0.46275. - That is above 0.04045, so the linear value is ((0.46275 + 0.055) / 1.055) ^ 2.4 = 0.49075 ^ 2.4 = 0.18116.
- All three channels are identical, so the weights (which sum to 1) give L = 0.18116.
- White has all channels at 1.0, so its luminance is 1.0.
- Ratio = (1.0 + 0.05) / (0.18116 + 0.05) = 1.05 / 0.23116 = 4.542.
That clears 4.5:1 by a thin margin. Repeat the steps for #777777, one step lighter in each channel, and the ratio is 4.478, which fails. Rounded to one decimal place, 4.478 would read as 4.5, and it still fails, because W3C’s Understanding documents say computed ratios “should not be rounded”. The calculator above shows the same figures to two decimal places: 21.00:1 for black on white, 4.48:1 for #777777 and 4.54:1 for #767676.
Which threshold applies
| Content | Level AA | Level AAA |
|---|---|---|
| Body text and other normal-size text, including placeholder text and text shown on hover or focus | 4.5:1 | 7:1 |
| Large-scale text | 3:1 | 4.5:1 |
| Visual information needed to identify a UI component or its state | 3:1 | 3:1 (no stricter AAA ratio) |
| Parts of graphics needed to understand the content | 3:1 | 3:1 (no stricter AAA ratio) |
Level AAA conformance includes every Level A and AA criterion, so the 3:1 of 1.4.11 still applies at AAA; WCAG sets no stricter ratio for non-text content. The Understanding document for 1.4.3 states that the criterion applies to placeholder text and to text revealed on hover or keyboard focus, so placeholder text must meet the same ratio as any other text of its size.
Why 4.5:1 and 7:1
W3C explains the numbers in the Understanding documents. 3:1 is the minimum recommended by ISO 9241-3 and ANSI/HFES 100-1988 for standard text and vision. In the population, 20/40 visual acuity is associated with a contrast-sensitivity loss of roughly 1.5, according to the empirical study W3C cites, so a user with 20/40 vision needs 3 x 1.5 = 4.5:1. By the same logic, 20/80 acuity needs about 7:1, which is the 1.4.6 figure.
What counts as large text
WCAG defines large-scale text as at least 18 point, or at least 14 point bold, or the equivalent size for Chinese, Japanese and Korean fonts. W3C gives the conversion 1pt = 1.333px, so 18 point is about 24 CSS pixels and 14 point is about 18.7 pixels (14 x 1.333 = 18.66). The Understanding document itself gives “approximately 18.5px” for 14 point, but 18.5px is slightly under 14 point, so bold text needs about 18.7px to qualify without argument. The definition uses the size at delivery, not any zoom the user applies, and it carries a warning that fonts with extraordinarily thin strokes are harder to read at lower contrast. A heading qualifies only if its rendered size and weight meet the definition; check the stylesheet instead of assuming.
What is exempt from 1.4.3
Text that is part of an inactive user interface component, pure decoration, text not visible to anyone, text that is part of a picture with significant other visual content, and logotypes have no contrast requirement. A disabled button is exempt; W3C’s own example is a visible submit button that cannot be activated until the required fields are completed. An instruction, price or form hint that someone must read is not exempt.
Interface states where contrast is lost
SC 1.4.11 requires 3:1 for “visual information required to identify user interface components and states”, except for inactive components and components whose appearance the browser determines and the author has not modified. The Understanding document adds several rulings that decide most state arguments:
- Focus. The visual focus indicator needs sufficient contrast against the adjacent background. At Level AAA, SC 2.4.13 Focus Appearance also requires an indicator area at least as large as a 2 CSS pixel thick perimeter of the component, with 3:1 between the same pixels in the focused and unfocused states.
- Selected and focused. Visual information that shows a selected or focused state must meet 3:1.
- Hover. Author-added hover styling is supplemental and is not required to meet 3:1, although the component itself must not lose contrast on hover.
- State changes between neighbors. A color change that distinguishes states of one component needs 3:1 only when the states appear next to each other.
- Graphics. Only the parts needed for understanding must pass, and not when text conveys the same information, the graphic is decoration, or its particular presentation is essential.
The table below applies both criteria to typical states. Ratios are computed with the formulas above, not read from a W3C table.
| Element and state | Foreground / background | Ratio | Verdict |
|---|---|---|---|
| Body text | #767676 on #FFFFFF | 4.54:1 | Passes 1.4.3 AA |
| Same text on a light gray card | #767676 on #F2F2F2 | 4.06:1 | Fails 1.4.3 AA |
| Same card, darker text | #6B6B6B on #F2F2F2 | 4.76:1 | Passes 1.4.3 AA |
| Text input border | #949494 on #FFFFFF | 3.03:1 | Passes 1.4.11 |
| Pale input border | #B3B3B3 on #FFFFFF | 2.10:1 | Fails 1.4.11 |
| Button label | #FFFFFF on #0B5FFF | 5.13:1 | Passes 1.4.3 AA |
| 24px gray heading | #808080 on #FFFFFF | 3.95:1 | Passes as large text (3:1), fails as normal text |
| Highlight text | #FFFF00 on #FFFFFF | 1.07:1 | Fails every threshold |
| Body text at AAA | #595959 on #FFFFFF | 7.00:1 | Passes 1.4.6 AAA (7.005) |
The #767676 rows show a rule of thumb that is easy to forget: a color that passes on white can fail on the slightly gray surface of a card, table stripe or sidebar. Test every surface a token lands on, in light and dark themes.
For a form field, check four relationships separately: the label against the page, the entered value against the field background, the error message against whichever surface it sits on, and the field boundary against the page. A dark label does not compensate for a pale error message or a border that disappears. The structure of those fields is covered in accessible form design and accessible form errors.
Color alone must also not carry meaning, so an error needs a text message and a programmatic link to its control, not just a stronger red. The full criteria list is in WCAG 2.2 explained.
Measuring the page that ships
Measure the computed colors in the browser’s inspector, not the design token name. WCAG measures against the specified background the text is rendered over in normal use. If a text color is specified without a background color, or the reverse, the specification treats that as a failure, because the user’s default background is unknown.
- Anti-aliasing. The specification notes that rendering settings are outside the author’s control, so the ratio can be evaluated with anti-aliasing off. Sample the intended text color, never a blended edge pixel.
- Borders around letters. A narrow border counts as part of the letter. A wide border that fills in the letter’s inner detail is a halo and counts as background.
- Images and gradients. Test the least favorable region the text can occupy at each layout. A dark corner behind the first line says nothing about the second. A solid or sufficiently opaque panel behind the text makes the result controllable.
- Adjacent pairs. WCAG conformance is evaluated for color pairs the author would expect to appear adjacent in typical presentation.
Record the page or component, state, theme, size and weight, both colors, the computed ratio and the criterion, so a second person can repeat the check. Retest the same state after the fix. Contrast sits alongside keyboard, labeling, zoom, target size and screen reader checks.
APCA and WCAG 3: not normative
APCA (the Accessible Perceptual Contrast Algorithm) is a contrast model from Myndex Research. Its documentation repository describes it as “a new way to predict contrast for text and non-text content on self-illuminated displays” and keeps an early white paper from the Visual Contrast group of Silver, the working name for WCAG 3, “for historical reasons”. The repository calls its own guidelines, the APCA Readability Criterion, an independent draft and a work in progress, and points people migrating from WCAG 2 contrast to a “Bronze Simple Mode” and to Bridge PCA, a variant that is backwards compatible with WCAG 2.
The standards position is plain. The WCAG 2.2 success criteria define conformance through the luminance-ratio formula above, so APCA values cannot demonstrate WCAG 2.2 conformance. The WCAG 3.0 Working Draft of 10 September 2026 says it is inappropriate to cite it as other than a work in progress. Its text-contrast requirement, still marked Developing, leaves the measure open (“contrast measure to be determined”) and names no algorithm, APCA included; the editor’s note reads: “The contrast algorithm used in WCAG 3 is yet to be determined.” The draft assumes the eventual algorithm will include a size and weight factor. It also states that content meeting WCAG 2.2 Level A and AA is expected to meet most of the minimum conformance level of the new standard, but that the new conformance model uses different tests and scoring, and some organizations may keep using WCAG 2.
In practice: report WCAG 2.2 ratios for conformance, claims and procurement. Treat APCA, if you use it at all, as a second opinion during design. In Europe, EN 301 549, the benchmark most teams use under the European Accessibility Act, takes its web requirements from WCAG. Version 3.2.1, which the Commission’s AccessibleEU centre still calls the current reference, is based on WCAG 2.1 Level AA, and version 4.1.1, published in September 2026, adopts WCAG 2.2 (AccessibleEU). An audit against either version checks the WCAG 2 ratio, not APCA.
Repairing a failing pair
- Record the failing pair and criterion (text 1.4.3, or component 1.4.11).
- For text, darken the foreground (on a light surface) or lighten it (on a dark one) until the ratio clears the threshold with some margin. For a filled button, compare changing the label color, the fill, or both.
- Choose one token that holds on every surface it lands on, or define separate tokens per surface.
- Retest every state: default, hover, focus, selected, expanded, error, loading, and each theme.
- Keep the same action recognizable across its states.
The #777777 to #767676 change crosses AA on white, but as the table shows, #767676 fails on a #F2F2F2 surface (4.06:1). Moving to #6B6B6B clears it there (4.76:1).
Sources
- W3C: Understanding SC 1.4.3 Contrast (Minimum), source of the 4.5:1 and 3:1 thresholds, the exceptions, the 4.499:1 no-rounding example, the placeholder ruling and the 1pt = 1.333px conversion.
- W3C: Understanding SC 1.4.6 Contrast (Enhanced), source of the 7:1 and 4.5:1 thresholds and the rationale for the ratios.
- W3C: Understanding SC 1.4.11 Non-text Contrast, source of the 3:1 requirement, the 2.999:1 no-rounding example and the state, focus, hover and graphics rulings.
- WCAG 2.2: definitions of relative luminance, contrast ratio and large scale, source of the formulas, their notes, the conformance levels and SC 2.4.13 Focus Appearance.
- W3C: WCAG 3.0 Working Draft, 10 September 2026, source for the status of the next-generation contrast algorithm.
- Myndex SAPC-APCA repository, the developer’s own description of APCA’s status.
- AccessibleEU: The European accessibility standard EN 301 549 has been updated (7 September 2026), source for the WCAG versions behind EN 301 549 v3.2.1 and v4.1.1.