Contrast Ratio Grid Accessibility Analyzer
Paste any color palette and instantly generate a full WCAG 2.1 contrast matrix. Check every foreground and background combination for AA, AAA, and Large Text compliance in one view.
Paste your color palette in the input panel to generate the contrast ratio grid. Each cell shows the calculated ratio with a Pass or Fail badge for the selected WCAG standard.
The Complete Guide to WCAG Color Contrast and Accessibility Compliance
Choosing accessible colors is one of the most impactful steps a designer or developer can take to make a website usable for the estimated 253 million people worldwide who live with some form of visual impairment. The contrast ratio between text and its background directly determines whether words are readable for users with low vision, color blindness, or aging eyesight. This guide explains the WCAG 2.1 contrast system, how to use this tool effectively, and the mathematical foundations behind every number in the matrix above.
How to Use the Contrast Ratio Grid Analyzer
Paste your brand or design system color palette into the input field on the left. You can enter colors as HEX codes (with or without the # prefix, both 3-digit and 6-digit formats are accepted), RGB values such as rgb(37, 99, 235), or HSL values such as hsl(221, 83%, 53%). Separate multiple colors with commas or line breaks. The grid regenerates instantly as you type.
Once the matrix appears, each row represents a foreground (text) color and each column represents a background color. The intersecting cell shows the calculated WCAG contrast ratio, a text sample rendered with that exact foreground and background combination, and a Pass or Fail badge based on the standard selected in the toggle. Use the hover effect to track a specific row or column across a large palette.
Reading the Contrast Scale
A ratio of 7:1 or higher means the color pair passes WCAG AAA and is excellent for all text sizes. Ratios between 4.5:1 and 6.99:1 pass WCAG AA for normal text. Ratios between 3:1 and 4.49:1 are only acceptable for large text (18pt or 14pt bold) and non-text UI components. Anything below 3:1 fails all WCAG standards for meaningful content.
The WCAG 2.1 Contrast Ratio Formula Explained
The WCAG contrast ratio is calculated as (L1 + 0.05) / (L2 + 0.05), where L1 is the relative luminance of the lighter color and L2 is the relative luminance of the darker color. This formula was derived from psychophysical research on human contrast sensitivity and ensures a consistent measurement independent of the display device.
Relative luminance is not the same as raw brightness. It corrects for the non-linear way sRGB encodes light. Each RGB channel is first normalized from a 0-255 integer to a 0-1 decimal. Values at or below 0.03928 are divided by 12.92 (the linear segment). Values above 0.03928 use the formula ((value + 0.055) / 1.055) raised to the power of 2.4. The three linearized channels are then combined as: 0.2126 times R plus 0.7152 times G plus 0.0722 times B. The green channel carries the most weight because the human eye contains far more green-sensitive cone cells than red or blue.
Why Color Alone Is Not Enough
WCAG contrast ratios measure luminance contrast only, which strips hue information entirely. This is intentional: approximately 8 percent of men and 0.5 percent of women have some form of color vision deficiency (color blindness). A red button on a green background may appear to have strong contrast to a trichromat viewer but is nearly invisible to someone with deuteranopia (the most common form of red-green color blindness). The luminance formula catches these cases because the luminance values of typical reds and greens are often very similar despite appearing dramatically different in hue.
This means passing the WCAG luminance contrast test is necessary but not sufficient for full accessibility. Supplementary measures include not relying on color alone to convey meaning, adding visible text labels or icons, and testing designs in grayscale to verify structure remains clear.