ToolNimba

๐ŸŽจ Accessible Color Checker, Black or White Text on Any Background

By ToolNimba Web Dev Team ยท Updated 2026-06-21

Live preview

The quick brown fox jumps over the lazy dog.

Readable heading sample

Recommended text color

-

-

Black text

-

  • AA normal (4.5:1)
  • AAA normal (7:1)
  • AA large (3:1)
White text

-

  • AA normal (4.5:1)
  • AAA normal (7:1)
  • AA large (3:1)

Pick a background color and this tool tells you instantly whether black or white text reads better on it. It computes the WCAG contrast ratio for both, recommends the more accessible choice, and shows whether each option passes AA and AAA. You can also type a custom text color to test any pairing, with a live preview so you can see the result before you ship it.

What is the Accessible Color Checker?

Readable text is mostly about contrast, the difference in brightness between the letters and the surface behind them. The Web Content Accessibility Guidelines (WCAG) put a number on this with the contrast ratio, which runs from 1:1 (identical colors, invisible text) up 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, color blindness, or anyone squinting at a phone in bright sun. Roughly one in twelve men and one in two hundred women have some form of color vision deficiency, so contrast is not a niche concern, it is core usability.

For most backgrounds the safest body-text choice is either solid black or solid white, because those two extremes sit at the ends of the brightness scale. The trick is knowing which one wins, and that is not always obvious by eye. A medium gray, a saturated blue, or a warm orange can each flip the answer. This checker removes the guesswork: it calculates the relative luminance of your background, then the contrast ratio against both black and white, and recommends whichever scores higher. Because the math weights green heavily and blue lightly, a bright lime can read like a light background while a deep navy of the same nominal lightness behaves like a dark one.

WCAG sets two pass levels. AA, the common legal and practical target, asks for at least 4.5:1 for normal text and 3:1 for large text (roughly 18pt, or 14pt bold). AAA is stricter at 7:1 for normal text and 4.5:1 for large text. Large text gets an easier bar because bigger letters are simply easier to read at lower contrast. There is also a separate 3:1 rule for non-text elements such as button borders, form-field outlines, icons, and focus indicators, which many designers forget. The tool shows pass or fail for each level so you can match whatever standard your project, client, or region requires.

Contrast requirements are not just best practice, they are frequently the law. The Americans with Disabilities Act (ADA) in the United States, Section 508 for federal agencies, the European Accessibility Act, and the EN 301 549 standard all reference WCAG AA as the baseline. Failing color contrast is one of the most common issues flagged in automated accessibility audits and one of the easiest to fix at design time, which is why checking it before you ship saves expensive retrofits and reduces legal exposure.

The WCAG 2 ratio formula is a good, stable default, but it is not perfect. It can be over-generous with light text on dark backgrounds and over-strict with some mid-tones. A newer model, APCA (the Advanced Perceptual Contrast Algorithm) being developed for WCAG 3.0, accounts for font size, font weight, and whether colors are light-on-dark or dark-on-light, often predicting real-world readability more accurately. Until WCAG 3.0 is finalized, WCAG 2 contrast ratios remain the conformance standard to test against, and this tool reports them, but it helps to know the rules are evolving.

Finally, remember that passing a ratio is a floor, not a ceiling. Real readability also depends on font choice, weight, size, line length, and the surrounding environment, such as glare on a phone outdoors or a dimmed laptop on a plane. Use the contrast ratio to guarantee a minimum, then sanity-check the live preview on the actual surface and, where possible, on real devices, before you commit a color pairing to production.

When to use it

  • Choosing readable button, badge, or label text once you have picked a brand background color.
  • Deciding between black and white text on a colored hero section, card, or call-to-action.
  • Checking that a custom text-on-background pairing meets WCAG AA before you ship a design.
  • Quickly auditing an existing color combination flagged in an accessibility report or Lighthouse scan.
  • Building an accessible design system or component library where every token needs a documented contrast result.
  • Validating email, slide, or print-to-screen palettes where colors are fixed and you must pick the readable text color.

How to use the Accessible Color Checker

  1. Enter or pick your background color using the hex box or the color swatch.
  2. Read the recommended text color (black or white) and its contrast ratio.
  3. Check the AA and AAA pass results shown for both black and white text.
  4. Optionally type a custom text color to test that exact pairing against the background.
  5. Use the live preview to confirm the text looks readable before applying it.
  6. Adjust the background slightly if you fail, then re-check until you clear the level you need.

Formula & method

Relative luminance L = 0.2126 x R + 0.7152 x G + 0.0722 x B, where each channel is first linearized: c = value / 255, then if c is at or below 0.03928 use c / 12.92, otherwise use ((c + 0.055) / 1.055) ^ 2.4. Contrast ratio = (L_lighter + 0.05) / (L_darker + 0.05). Black text scores higher when its ratio is greater than or equal to white text on the same background.

Worked examples

You have a dodger-blue background (#1E90FF) and need readable button text.

  1. Linearize the background channels R=30, G=144, B=255 and compute its luminance, about 0.2744
  2. Black luminance is 0, so contrast = (0.2744 + 0.05) / (0 + 0.05) = 6.49:1
  3. White luminance is 1, so contrast = (1 + 0.05) / (0.2744 + 0.05) = 3.24:1
  4. Black (6.49:1) beats white (3.24:1), so black is recommended
  5. Black passes AA normal (at least 4.5) and AA large (at least 3) but not AAA normal (needs 7)

Result: Use black text. Contrast 6.49:1, passes WCAG AA for normal and large text.

You have a royal-blue background (#2563EB) and want to know which text color is accessible.

  1. Compute the background luminance, about 0.1532
  2. Black contrast = (0.1532 + 0.05) / (0 + 0.05) = 4.06:1
  3. White contrast = (1 + 0.05) / (0.1532 + 0.05) = 5.17:1
  4. White (5.17:1) beats black (4.06:1), so white is recommended
  5. White passes AA normal (at least 4.5); black would fail AA normal here

Result: Use white text. Contrast 5.17:1, passes WCAG AA for normal and large text.

You want a light-gray body text (#999999) on a white background (#FFFFFF) and need to know if it is legal for paragraphs.

  1. White luminance is 1.0; light gray #999999 luminance is about 0.318
  2. Contrast = (1 + 0.05) / (0.318 + 0.05) = 2.85:1
  3. Compare against AA normal text, which needs 4.5:1
  4. 2.85:1 is below 4.5:1, so it fails AA for normal text, and also fails the 3:1 large-text bar
  5. Darken the gray toward #767676, which reaches about 4.54:1, to pass AA normal text

Result: Fails. #999999 on white is only 2.85:1; use #767676 or darker to meet WCAG AA for body text.

WCAG contrast ratio thresholds by conformance level and content type

Content typeAA minimumAAA minimum
Normal text (under 18pt, or under 14pt bold)4.5:17:1
Large text (18pt+, or 14pt+ bold)3:14.5:1
Graphics and UI components (borders, icons, focus)3:1not defined
Disabled controls and pure decorationno requirementno requirement

Recommended text color for common background colors

BackgroundBlack ratioWhite ratioRecommended
#FFFFFF white21.00:11.00:1Black
#000000 black1.00:121.00:1White
#1E90FF dodger blue6.49:13.24:1Black
#2563EB royal blue4.06:15.17:1White
#FFD700 gold14.97:11.40:1Black
#777777 mid gray4.69:14.48:1Black
#16A34A green5.32:13.95:1Black
#DC2626 red4.26:14.93:1White
#7C3AED purple3.20:16.57:1White
#F97316 orange8.34:12.52:1Black

What each contrast ratio band means in practice

Ratio rangeReadabilityConformance
1:1 to 2.9:1Hard to read or invisibleFails all WCAG levels
3:1 to 4.4:1OK for large text and UI parts onlyAA large text only
4.5:1 to 6.9:1Comfortable for body textAA normal, AAA large
7:1 to 21:1High contrast, strong legibilityAA and AAA all sizes

Common mistakes to avoid

  • Judging readability by eye instead of by ratio. Mid-tone backgrounds like a medium gray or saturated teal can look fine with either text color, but only one actually passes WCAG. On #777777, black scores 4.69:1 and white only 4.48:1, so black is the safer pick even though both look close.
  • Treating AA large text as good enough for body copy. The 3:1 large-text threshold only applies to text that is 18pt or larger (or 14pt+ bold). Paragraphs, labels, and small captions must reach 4.5:1 for AA. Do not use the easier large-text bar for normal-size text.
  • Forgetting hover, focus, and disabled states. A button might pass when idle but fail on hover if the background lightens or darkens. Check every state your background can take, not just the default one, and remember focus indicators need 3:1 against their surroundings.
  • Assuming a higher ratio always looks better. Pure black on pure white (21:1) can cause glare and eye strain for some readers. Meeting AA or AAA is the goal, not maxing out the number, so a comfortable dark gray often reads better than absolute black.
  • Ignoring non-text contrast for icons and borders. Contrast rules are not only for text. Input outlines, toggle states, chart lines, and meaningful icons must clear 3:1 against adjacent colors, or users who rely on those cues cannot perceive them.
  • Relying on color alone to convey meaning. Even with perfect contrast, do not use color as the only signal for errors, links, or status. Add text, underlines, or icons so people with color blindness get the same information.

Glossary

Contrast ratio
A number from 1:1 to 21:1 describing the brightness difference between text and its background. Higher means more readable.
Relative luminance
The perceived brightness of a color on a 0 to 1 scale, weighting green most and blue least, used to compute contrast.
WCAG
Web Content Accessibility Guidelines, the international standard that defines contrast and other accessibility requirements.
AA level
The common conformance target: at least 4.5:1 for normal text and 3:1 for large text.
AAA level
The strictest conformance level: at least 7:1 for normal text and 4.5:1 for large text.
Large text
Text at least 18pt, or 14pt and bold, which is allowed a lower contrast threshold because it is easier to read.
Non-text contrast
A WCAG rule requiring at least 3:1 contrast for UI components and meaningful graphics such as icons, borders, and focus indicators.
APCA
The Advanced Perceptual Contrast Algorithm proposed for WCAG 3.0, which factors in font size and weight for more realistic readability predictions.

Frequently asked questions

How do I know if black or white text is more readable?

Enter your background color and the tool computes the WCAG contrast ratio against both black and white, then recommends whichever scores higher. As a rule, light backgrounds favor black text and dark backgrounds favor white, but mid-tones can go either way, which is exactly when the calculated ratio settles it.

What contrast ratio do I need to pass WCAG?

For AA, normal text needs at least 4.5:1 and large text (18pt+, or 14pt+ bold) needs at least 3:1. For the stricter AAA level, normal text needs 7:1 and large text needs 4.5:1. The tool shows pass or fail for each of these so you can match your required standard.

What is the difference between AA and AAA?

AA is the widely used baseline, required by most accessibility laws and design systems. AAA is a stricter, optional level with higher contrast minimums. Aim for AA across your interface, and reach for AAA on critical or small text where you can.

Can I test a custom text color instead of black or white?

Yes. Type or pick a custom text color in the second field and the tool shows its contrast ratio against your background plus its AA and AAA pass results, so you can validate any brand pairing, not just black or white.

Why does my mid-gray background recommend black when white looks fine too?

On a medium background both colors can land near the same ratio, but only the higher one is the accessible choice. For example on #777777 black scores 4.69:1 and white 4.48:1, so black is recommended even though the difference is small and both look acceptable by eye.

Does a higher contrast ratio always mean a better design?

Not always. Meeting AA or AAA is the goal, but maximum contrast like pure black on pure white can cause glare for some readers. Once you clear the threshold you need, choosing a slightly softer dark or light tone can be more comfortable to read.

What counts as large text under WCAG?

Large text is at least 18pt (about 24px) for regular weight, or at least 14pt (about 18.66px) when bold. Large text only needs 3:1 for AA and 4.5:1 for AAA. Anything smaller is normal text and must hit 4.5:1 for AA.

Is white or black text better for accessibility on colored buttons?

It depends on the button color, which is why you should check rather than guess. Light, warm, or bright fills like gold, lime, and orange usually need black text, while deep blues, purples, and reds usually need white text. Enter the exact fill and the tool picks the higher-contrast option.

Does this checker account for color blindness?

The WCAG contrast ratio is designed to help most users including many with low vision and color vision deficiency, because it measures luminance rather than hue. Still, you should never rely on color alone for meaning. Pair good contrast with text labels, icons, or underlines so the information survives any kind of color blindness.

What is APCA and should I use it instead of WCAG 2?

APCA is a newer contrast model being developed for WCAG 3.0 that factors in font size and weight, often predicting real-world readability more accurately than the WCAG 2 ratio. Until WCAG 3.0 is finalized, WCAG 2 ratios remain the legal and conformance standard, so this tool reports those, but it is worth watching APCA as the rules evolve.