How to use the Contrast checker tool
- Type the text color into Foreground color as a 3- or 6-digit hex value such as #17252e, or as rgb(23, 37, 46).
- Type the color behind the text into Background color, using either notation.
- Select Check contrast, or select Example to load dark slate text on a pale gray page.
- Read the ratio and the four Pass or Fail lines in the Result box, then select Copy to paste them into a ticket or design review.
How the WCAG contrast ratio is calculated
WCAG 2 defines contrast as a ratio of relative luminance, a measure of how much light a color sends to the eye. Each 8-bit sRGB channel is divided by 255 and then linearized: values up to 0.04045 are divided by 12.92, and higher values go through ((c + 0.055) / 1.055) raised to the power 2.4. The linear channels are weighted 0.2126 for red, 0.7152 for green and 0.0722 for blue, because the eye is most sensitive to green.
The ratio is (L1 + 0.05) / (L2 + 0.05), where L1 is the lighter of the two luminances. The 0.05 term stands for ambient light reflected by the screen. Results run from 1:1 for two identical colors to 21:1 for black on white.
A worked example: slate text on pale gray
The Example button fills in #17252e on #f4f6f8. The dark color has a relative luminance of about 0.017 and the light one about 0.919, so the ratio is 0.969 / 0.067, which the tool reports as 14.46:1. That clears every threshold.
Mid grays are where it gets tight. On a white background, #767676 scores 4.54:1 and passes AA for body text, while #777777 scores 4.48:1 and does not.
Foreground color: #17252e
Background color: #f4f6f8
Contrast: 14.46:1
Normal text AA: Pass
Normal text AAA: Pass
Large text AA: Pass
Large text AAA: PassWhat the four Pass and Fail lines mean
The tool compares the unrounded ratio with the thresholds from two success criteria: 1.4.3 Contrast (Minimum) at level AA and 1.4.6 Contrast (Enhanced) at level AAA. WCAG counts text as large when it is at least 18 point, or at least 14 point and bold, which is roughly 24px regular or 18.66px bold in CSS.
- Normal text AA: at least 4.5:1.
- Normal text AAA: at least 7:1.
- Large text AA: at least 3:1.
- Large text AAA: at least 4.5:1.
Color formats the contrast checker accepts
Both fields use one parser. It accepts a hex color with a leading # and three or six digits, in either letter case, or an rgb() value with three whole numbers from 0 to 255 separated by commas or spaces. Anything else stops with the message Enter a 3- or 6-digit hex color or rgb(r, g, b). These inputs are not supported:
- Named colors such as white or rebeccapurple.
- Alpha values. 8-digit hex and rgba() are rejected, so blend a transparent color with its backdrop first.
- hsl() values, percentages and decimal channel values.
- Gradients and background images, which have no single color to measure.
Frequently asked questions
What contrast ratio does WCAG AA require?
Level AA requires at least 4.5:1 for normal text and 3:1 for large text, meaning 18 point or larger, or 14 point bold or larger. Level AAA raises those figures to 7:1 and 4.5:1. This tool prints a Pass or Fail line for each of the four cases.
Why does the result show 4.50:1 but still fail AA?
The ratio is rounded to two decimals for display, but the verdict uses the full value. #0078d7 on white is about 4.4989:1, which prints as 4.50:1 and misses the 4.5 threshold. WCAG does not allow rounding up, so treat that Fail as real and darken the color slightly.
Does it matter which color goes in the foreground field?
Not for the ratio. The formula always divides the lighter luminance by the darker one, so white on teal and teal on white give the same value.
Can I check a semi-transparent color?
Not directly, because contrast depends on the final blended color. Work out the opaque color that results from placing the transparent one over its background, then enter that value.