ToolNimba Browse

🌗 Color Contrast Checker (WCAG)

By ToolNimba Editorial Team · Updated 2026-06-19

The quick brown fox jumps over the lazy dog.

Large heading sample text

21.00:1 contrast ratio

Normal text

  • AA (4.5:1)
  • AAA (7:1)

Large text (18pt+ or 14pt+ bold)

  • AA (3:1)
  • AAA (4.5:1)

This color contrast checker measures how readable text is against its background using the official WCAG formula. Enter a foreground (text) color and a background color as hex values or pick them visually, and you instantly see the contrast ratio along with pass or fail results for WCAG AA and AAA at both normal and large text sizes. A live preview shows the actual color pairing so you can judge readability at a glance.

What is the Contrast Checker?

Color contrast is the difference in perceived brightness between text and its background. The Web Content Accessibility Guidelines (WCAG) measure it as a ratio that ranges from 1:1 (identical colors, invisible text) to 21:1 (pure black on pure white). The higher the ratio, the easier the text is to read, especially for people with low vision or color vision deficiencies. Good contrast also helps everyone in bright sunlight, on cheap screens, or when glancing quickly.

The ratio is not a simple comparison of hex values. WCAG first converts each color to its relative luminance, a number that models how bright a human eye perceives it. Each red, green, and blue channel is scaled to a 0 to 1 range, linearized with a gamma curve, and then weighted (green counts most, blue least, because the eye is most sensitive to green). The contrast ratio is then (L1 + 0.05) divided by (L2 + 0.05), where L1 is the lighter color and L2 the darker one. The 0.05 term accounts for ambient screen glare.

WCAG sets two thresholds. Level AA, the common legal and practical baseline, requires 4.5:1 for normal text and 3:1 for large text. Level AAA is stricter at 7:1 for normal and 4.5:1 for large text. Large text is defined as 18pt (about 24px) and larger, or 14pt (about 18.66px) bold and larger, since bigger glyphs stay legible at lower contrast. Logos and purely decorative text are exempt.

When to use it

  • Checking whether your website body text meets WCAG AA before launch or an accessibility audit.
  • Choosing a button text color that stays legible against a brand background color.
  • Validating a design system palette so every text-on-surface pairing passes a known threshold.

How to use the Contrast Checker

  1. Enter the foreground (text) color as a hex value, or use the color picker.
  2. Enter the background color the same way.
  3. Read the contrast ratio shown at the top of the results.
  4. Check the AA and AAA pass or fail badges for normal and large text.
  5. Use Swap colors to test the reverse pairing, and watch the live preview update.

Formula & method

For each channel c (0 to 1): if c ≤ 0.03928, clin = c / 12.92, else clin = ((c + 0.055) / 1.055)2.4.   L = 0.2126·Rlin + 0.7152·Glin + 0.0722·Blin.   ratio = (Llighter + 0.05) ÷ (Ldarker + 0.05).

Worked examples

Black text (#000000) on white (#FFFFFF), the maximum possible contrast.

  1. White luminance L = 1.0 (all channels are 255, fully linearized to 1).
  2. Black luminance L = 0.0 (all channels are 0).
  3. ratio = (1.0 + 0.05) / (0.0 + 0.05) = 1.05 / 0.05 = 21

Result: 21:1, passes AA and AAA at every text size.

Medium gray text (#767676) on white (#FFFFFF), a classic borderline case.

  1. Channel value 0x76 = 118, so c = 118 / 255 = 0.4627.
  2. Linearized: ((0.4627 + 0.055) / 1.055)^2.4 = 0.1812, so gray L = 0.1812.
  3. ratio = (1.0 + 0.05) / (0.1812 + 0.05) = 1.05 / 0.2312 = 4.54

Result: 4.54:1, just passes AA for normal text (4.5) but fails AAA (7).

WCAG contrast ratio requirements by level and text size

Conformance levelNormal textLarge text
AA (minimum)4.5:13:1
AAA (enhanced)7:14.5:1
Non-text UI (AA)3:13:1

What counts as "large text" under WCAG

StyleMinimum size
Regular weight18pt (about 24px)
Bold weight14pt (about 18.66px)

Common mistakes to avoid

  • Comparing hex numbers instead of luminance. Contrast is not the numeric gap between hex codes. Two colors can have similar hex values but very different perceived brightness. Always use the luminance-based ratio, which is what this tool computes.
  • Assuming all text needs 4.5:1. Large text only needs 3:1 for AA. Headings and big labels can use lower contrast than body copy, which gives more design freedom without failing the guideline.
  • Forgetting hover, focus, and disabled states. A pairing that passes at rest can fail when a link turns a lighter shade on hover or when placeholder text is dimmed. Check every state, not just the default one.
  • Ignoring contrast on icons and form borders. WCAG 1.4.11 requires 3:1 for meaningful non-text elements like icons, input outlines, and focus rings, not just text. A pretty but faint border can still be a failure.

Glossary

Contrast ratio
A number from 1:1 to 21:1 describing the luminance difference between two colors. Higher means more readable.
Relative luminance
A 0 to 1 value modeling how bright the human eye perceives a color, after gamma correction and channel weighting.
WCAG
Web Content Accessibility Guidelines, the international standard for making web content usable by people with disabilities.
Level AA
The mid tier of WCAG conformance, widely used as the legal and practical baseline for contrast.
Large text
Text at 18pt and up, or 14pt and up if bold. It qualifies for the lower 3:1 (AA) contrast threshold.

Frequently asked questions

What is a good color contrast ratio?

A ratio of 4.5:1 or higher passes WCAG AA for normal text, and 7:1 or higher passes the stricter AAA level. Large text needs only 3:1 for AA. Aim for at least 4.5:1 on body copy.

How is WCAG contrast ratio calculated?

Each color is converted to relative luminance: channels are scaled to 0 to 1, gamma corrected, and weighted (0.2126 red, 0.7152 green, 0.0722 blue). The ratio is (lighter luminance + 0.05) divided by (darker luminance + 0.05).

What is the difference between WCAG AA and AAA?

AA is the common baseline: 4.5:1 for normal text and 3:1 for large text. AAA is the enhanced level: 7:1 for normal and 4.5:1 for large text. Most sites target AA, while AAA suits high-accessibility contexts.

What counts as large text for contrast?

Large text is 18pt (about 24px) or larger at normal weight, or 14pt (about 18.66px) or larger when bold. Large text qualifies for the lower 3:1 AA threshold instead of 4.5:1.

Does contrast apply to icons and buttons?

Yes. WCAG 1.4.11 requires a 3:1 ratio for meaningful non-text elements such as icons, input borders, and focus indicators, so check those alongside your text colors.

Why does black on white give 21:1?

Pure white has a relative luminance of 1.0 and pure black 0.0. Plugging these into the formula gives (1.0 + 0.05) / (0.0 + 0.05) = 21, the maximum possible contrast ratio.