Quick answer: To use a color contrast checker, open the NimbusCalc color contrast checker, enter a foreground text color and a background color, and read the contrast ratio plus the AA and AAA pass or fail results. The tool computes (Llighter + 0.05) / (Ldarker + 0.05) using WCAG relative luminance. WCAG 2.1 Level AA needs 4.5:1 for normal text and 3:1 for large text; Level AAA needs 7:1 and 4.5:1. Pure black on pure white is the maximum at 21:1. The default pair #1A1A1A on #FFFFFF scores 17.40:1 and passes every threshold.

What a color contrast checker measures

A contrast ratio expresses how much lighter one color is than another on a scale from 1:1 (identical colors) to 21:1 (pure black against pure white). It is not a simple difference in brightness values. Human vision is far more sensitive to green light than to blue light, so the calculation weights the three sRGB channels differently. A pale yellow and a pale blue can look similarly bright while producing very different contrast ratios against the same background.

The Web Content Accessibility Guidelines (WCAG) 2.1, published by the W3C Web Accessibility Initiative, use this ratio as the measurable part of text legibility. Success Criterion 1.4.3 sets the Level AA minimum and Success Criterion 1.4.6 sets the stricter Level AAA minimum. Success Criterion 1.4.11 covers UI components. The checker implements the normative formula exactly, without rounding intermediate values.

How to check text and background contrast (step by step)

Color contrast checker workflow from foreground and background colors to AA and AAA pass results

The first tab is “1. Contrast checker”. It is selected on load and accepts #RGB, #RRGGBB, rgb(127, 86, 217) and hsl(258.8, 63.3%, 59.4%) values. Values update as you type.

  1. Enter the “Text color (foreground)”. The text field has placeholder “#1A1A1A” and default #1A1A1A. Use the “Foreground picker” color input to choose visually instead.
  2. Enter the “Background color”. Placeholder “#FFFFFF”, default #FFFFFF, with a separate “Background picker”.
  3. Or choose a “Try a sample pair” preset. The dropdown offers “Choose a sample pair”, “#767676 on white – barely passes AA”, “#FF0000 on white – fails AA normal text”, “#595959 on white – passes AAA” and “#E2E8F0 on dark slate”.
  4. Read the “CONTRAST RATIO” card. The default shows 17.40:1 with the derivation (max(0.010330, 1.000000) + 0.05) / (min(0.010330, 1.000000) + 0.05) = 17.40:1.
  5. Check the five pass or fail rows. The tool reports AA normal text (4.5:1), AA large text (3:1), AAA normal text (7:1), AAA large text (4.5:1) and UI components (3:1). All five read PASS for the default pair.
  6. Read the color breakdown. FOREGROUND shows #1A1A1A / rgb(26, 26, 26) / hsl(0, 0%, 10.2%) and BACKGROUND shows #FFFFFF / rgb(255, 255, 255) / hsl(0, 0%, 100%).
  7. Use the helpers. “Swap colors” inverts the pair, “Copy result as JSON” exports the numbers, and “Use suggested color” applies the “SUGGESTED AA TEXT COLOR”.

A live sample reads “Aa Bb Cc 123 — the quick brown fox” at normal size in your exact colors, so you can judge legibility visually as well as numerically.

WCAG AA and AAA thresholds explained with exact ratios

WCAG contrast threshold chart showing AA 4.5:1, AA large 3:1 and AAA 7:1 with sample color pairs

Requirement Minimum ratio Applies to
WCAG 2.1 AA, SC 1.4.3 4.5:1 Normal text and images of text
WCAG 2.1 AA, SC 1.4.3 3:1 Large text (at least 18 pt, or 14 pt bold)
WCAG 2.1 AAA, SC 1.4.6 7:1 Normal text and images of text
WCAG 2.1 AAA, SC 1.4.6 4.5:1 Large text
WCAG 2.1 AA, SC 1.4.11 3:1 UI components, focus indicators, meaningful graphics

The exact WCAG formula has three steps. Divide each 8-bit channel by 255 to get c. Linearize it: if c ≤ 0.03928 use c / 12.92, otherwise use ((c + 0.055) / 1.055)^2.4. Combine the linearized channels with L = 0.2126 R + 0.7152 G + 0.0722 B. Finally, contrast ratio = (Llighter + 0.05) / (Ldarker + 0.05). The 0.05 offset accounts for ambient flare and stops a pure black background from producing a division by zero, which is why the scale tops out at 21:1.

The “Common color pairs and their exact ratios” table is computed live from that same formula. Black #000000 on white #FFFFFF is 21.00:1. #595959 on white is 7.00:1. #767676 on white is 4.54:1 and passes AA normal text. #7F56D9 on white is 4.96:1. Pure red #FF0000 on white is 4.00:1 and fails AA normal text. #777777 on white gives 4.478:1 and fails, so a single step in the 8-bit gray value can decide compliance.

How to convert HEX, RGB and HSL in the second tab

Switch to “2. HEX / RGB / HSL converter” and enter a “Color value” (placeholder #7F56D9) or use its “Color picker”. HEX stores each channel as two base-16 digits: #7F56D9 is red 0x7F = 127, green 0x56 = 86 and blue 0xD9 = 217. Three-digit shorthand duplicates each digit, so #F0A expands to #FF00AA. HSL is a cylindrical transformation where hue is an angle on the color wheel, saturation is distance from gray and lightness is the midpoint between black and white; hsl(258.8, 63.3%, 59.4%) round-trips to #7F56D9.

HSL is useful for fixing contrast because changing lightness keeps the hue and saturation of a brand color. The “suggested-color” feature sweeps lightness from 0% to 100% at fixed hue and saturation and returns the closest value that reaches 4.5:1 against your background.

Common mistakes when using a color contrast checker

  • Using the difference of HEX or RGB values. Contrast is a ratio of linearized luminances, not a subtraction of channel numbers.
  • Skipping gamma linearization. Applying 0.2126 / 0.7152 / 0.0722 directly to sRGB values produces substantially wrong ratios.
  • Testing text over an image with one background color. Text must pass against the lightest and darkest areas it overlaps, or sit on a solid overlay.
  • Ignoring opacity. Semi-transparent text composites with the background first. This tool deliberately accepts fully opaque colors only.
  • Checking only default states. Hover, focus, visited, disabled and placeholder styles each need their own check.
  • Assuming large text means visually big. WCAG uses a specific definition, about 24 px regular or 18.66 px bold in CSS pixels.

Where this fits in your NimbusCalc workflow

Contrast is part of a wider design workflow. Before publishing graphics, the image compression guide explains how to keep file sizes small, and the Word to PDF conversion guide covers sharing accessible documents. Clean up the text first with the article formatting tool, and turn brand palettes into visuals with the one-sentence chart generator. Defining colors precisely is the same discipline as defining numbers in the online scientific calculator guide.

These NimbusCalc guides use the same step-by-step format. Continue with the JSON formatter guide for design tokens stored as JSON and the percentage calculator guide for opacity and ratio arithmetic.

Frequently asked questions

What contrast ratio does WCAG AA require?

Level AA requires 4.5:1 for normal text and 3:1 for large text. UI components and meaningful graphics need 3:1.

What is the maximum contrast ratio?

21:1, achieved by pure black #000000 on pure white #FFFFFF. The scale starts at 1:1 for identical colors.

Why does #767676 pass AA but #777777 fail?

#767676 on white gives 4.542:1, just above 4.5:1. #777777 gives 4.478:1 and fails. One 8-bit step can decide compliance.

Can I check semi-transparent colors?

No. The tool accepts fully opaque colors only. Composite a semi-transparent color with its background first, then test the resulting opaque value.

Does the converter support RGB and HSL input?

Yes. The checker accepts #RGB, #RRGGBB, rgb(127, 86, 217) and hsl(258.8, 63.3%, 59.4%), and tab 2 converts between HEX, RGB and HSL.