Check text contrast over a background image

Measure text contrast over a background image at the weakest point behind the letters. Test a new crop and choose a backing color when a photo varies.

2 min read · Updated 2026-11-22

Find the weakest part of the photo

For white text, start with the brightest patch behind the letters. For black text, start with the darkest. A photo’s average color can hide a failure where just one word crosses a window or a shadow. Capture the final layout, then hide the lettering without moving the image to sample the background at those positions.

Sample the background behind the letters

Test the foreground against each sampled background

Enter the text color and a sampled background as a pair in the contrast checker. White on white yields 1:1 and white on black yields 21:1. Use these pairs to check your setup. For ordinary body text under WCAG AA, each tested pair needs at least 4.5:1. A handful of passing samples on a busy photo may still miss a failing region.

Measure a text and background pair

Keep contrast stable as the crop moves

A desktop headline over dark foliage may sit over the sky once the image is cropped on a phone. Try the narrow layout, longer translated text and a replacement photo. An opaque panel behind the whole text block gives you a single background to check. For a translucent scrim, sample the composited result again wherever the image is brightest or darkest.

Tools featured in this guide

Related formats

Frequently asked questions

Can I sample a pixel at the edge of a letter?

Use the specified text color. Anti-aliased edge pixels contain a blend of the text and the background and can give a misleading value.

What if a content editor can replace the image?

Provide a solid text backing or place the caption outside the photo. Verify the text against that surface so the next image can change independently.

Authoritative Specifications & References

More color guides