A PDF's text and background colors produce a single contrast ratio, and that number decides whether the document passes WCAG accessibility rules. The ratio is calculated from the two color values themselves, not from the file format, which means the same math applies whether your text sits on a PDF page, a web page, or a slide deck. Under WCAG 2.x, the formula is (L1 + 0.05) / (L2 + 0.05), where L1 is the relative luminance of the lighter color and L2 the relative luminance of the darker one. To get there, each color channel is first converted from sRGB to linear light and weighted by 0.2126 for red, 0.7152 for green, and 0.0722 for blue. The result always falls between 1:1 (identical colors) and 21:1 (pure white on pure black). Once you have the ratio, you can map it to a conformance level: AA needs 4.5:1 for normal text and 3:1 for large text, while AAA raises those to 7:1 and 4.5:1.

how to check color contrast in pdf
how to check color contrast in pdf

Why PDF Contrast Affects Real Readers

PDFs are often shared as the "final" version of a document: a contract, a report, a government form, an academic paper. Once they are out the door, the reader's ability to consume them depends entirely on the colors that ship with the file. Roughly one in twelve men and one in two hundred women have some form of color vision deficiency, and millions more read with low vision, cataracts, or on cheap screens in bright sunlight. When the contrast between body copy and its background is too low, every one of those readers loses the text, regardless of how good the content is.

Contrast is also a legal requirement in many places. The Americans with Disabilities Act (ADA) is routinely applied to websites and digital documents in the United States, Section 508 mandates it for federal agencies, and the European standard EN 301 549 references WCAG directly for public-sector sites. Many "tagged for accessibility" PDF checkers will flag low contrast during validation, but they do not fix the problem; they just tell you a color pair failed. The actual fix happens at the design stage, before the PDF is exported, which is why testing color pairs before publication is the most reliable path.

Getting the Colors Out of Your PDF

A contrast checker works on two color values, not on a PDF file, so the first job is to identify the exact text color and the exact background color you actually used. There are a few reliable ways to pull these out, depending on the tools you have.

In Acrobat Pro, open the PDF and choose Tools → Print Production → Output Preview. From the preview options, place a crosshair over the text and the surrounding background; Acrobat reports the CMYK and RGB values for the pixels under the cursor. In Acrobat Reader, the eyedropper tool inside the color picker of the Properties panel works for simpler documents. Many other PDF editors, including Preview on macOS, expose the same eyedropper.

For designs created in InDesign, Word, PowerPoint, or Google Docs before export, you do not need to sample a pixel at all. Open the paragraph or character style and read the hex or RGB values directly from the swatch panel. If your PDF was produced by a third party, ask them for the source color values; reverse-engineering them from a flattened export is fragile, especially if the PDF was compressed. For a full extractor walkthrough across more stubborn cases, see the guide on checking color contrast in PDFs easily.

Write down the foreground hex (text) and the background hex (the color the text sits on), then move to the contrast checker.

Run the Two Colors Through the Contrast Checker

Once you have the two hex values, plug them into the Color Contrast Checker to see the ratio and the pass/fail status for every threshold at once.

  1. Set the foreground (text) color using the color picker or by typing a hex value like #111111.
  2. Set the background color the same way, for example #ffffff.
  3. Read the contrast ratio and the AA/AAA pass or fail badges, and adjust either color until it meets the level you need.

If a color pair fails, the simplest fix is usually to darken the text or lighten the background. If the brand color is locked, the next best move is to swap the body text to a darker tone of the same hue rather than introduce a new color. Save the passing pairs to a small style sheet so future PDFs can reuse them.

A Quick Worked Example

To make the formula tangible, take the pair from the first step of the checklist: #111111 on #ffffff.

For #111111, each channel has an sRGB value of 17/255, or about 0.0667. Because that value is above the 0.03928 cutoff, the linear value is ((0.0667 + 0.055) / 1.055)^2.4, which works out to roughly 0.00562 per channel. Applying the luminance weights (0.2126 × 0.00562) + (0.7152 × 0.00562) + (0.0722 × 0.00562) gives a relative luminance of about 0.00562. For #ffffff, the relative luminance is 1.0.

Plugging those into the ratio formula: (1.0 + 0.05) / (0.00562 + 0.05) = 1.05 / 0.05562 ≈ 18.88:1. That comfortably clears AA normal text (4.5:1), AAA normal text (7:1), and every threshold below.

The WCAG Thresholds at a Glance

The numbers themselves are short, but they are the difference between a passing document and one that gets flagged. The table below collects every contrast threshold the WCAG 2.x specification defines for text and non-text content.

ElementAAAAA
Normal text4.5:17:1
Large text (18pt regular or 14pt bold and up)3:14.5:1
UI components, icons, graphical objects3:1not specified

Anything that does not meet the AA column at minimum should be treated as a fail. Treat AAA as a stretch target: aiming for it where the layout allows gives comfortable reading for the widest audience, including readers with low vision, glare, or aging eyes.

What the Contrast Ratio Does Not Cover

The ratio is a measure of luminance contrast, not hue. Two colors with very different hues but similar brightness, for example a medium red on a medium green, can still fail, even though they look "different" to some viewers. That is also why relying on color alone to convey meaning is discouraged in WCAG; pair color cues with text labels, icons, or underlines.

Gradients, semi-transparent overlays, and text placed on photographic backgrounds are tricky because the effective background changes across the element. A safe practice is to test against the lightest and darkest points a letter could sit on. If the contrast holds at both extremes, it holds everywhere in between. Placeholder text, disabled-state buttons, error messages, and thin decorative fonts are common failure spots worth a second check.

Finally, remember that contrast is a property of the color pair, not of which color is text. Swapping foreground and background in the checker produces the exact same ratio, so the order you type them in does not matter.

Practical Tips for Accessible PDF Color Choices

Build the palette around a small set of approved pairs and apply them consistently. Most PDFs need no more than two or three text-on-background combinations: one for body copy, one for headings, and one for accent text such as captions. For each, write the foreground and background hex values down and check them once with the contrast tool. Store the pairs in a comment or a brand sheet so the next person editing the document does not accidentally introduce a low-contrast combination.

When working with a brand color that does not pass, look at saturation rather than hue. A deeply saturated brand color often has a high luminance and therefore needs a darker text shade on top of it. Darkening the brand color itself by 10 to 20 percent usually moves the contrast ratio up by a couple of points without making the color look noticeably different. Test your final pair once more before exporting, especially if the PDF will be printed, because ink-on-paper contrast can differ from screen contrast, and re-checking with the actual printed swatch is worth the extra minute.

Everything in the Color Contrast Checker runs locally in your browser, so you can test brand palettes, design tokens, and design-system colors privately without uploading anything. The same workflow applies whether the document ends up as a PDF, a web page, or a slide deck, because the ratio, the thresholds, and the math are identical.