Blank pages get into PDFs in three ways: a duplex scanner dutifully capturing the back of every single-sided sheet, a word processor emitting a trailing page nobody wanted, and a merge that stitched separator sheets into the middle of a document. All three produce the same annoyance — a file that is longer than it should be, prints wastefully, and reads badly. This guide covers finding blank pages reliably and removing them without breaking the rest of the document.
First, decide what "blank" means
This sounds pedantic and is the whole problem. A page can be:
- Genuinely empty: no content stream to speak of, no images, nothing. Easy to detect.
- Visually blank but not empty: a scanned back-of-page that is a full-page image of off-white paper, complete with dust specks, a faint show-through of the printing on the other side, and a scanner's edge shadow. To a computer this page is 400 KB of image data and absolutely not blank.
- Nearly blank: a page containing only a header, footer, or page number — which most people want kept, because removing it renumbers everything.
The second case is the one that defeats naive tools, and it is the one you will meet most often, because duplex scanning is where blank pages come from. See fixing page order from duplex scanning for the related mess.
Manual removal, for a handful of pages
When there are five blanks in a forty-page file, do not automate. Open, look, delete:
- Adobe Acrobat: open the page thumbnails panel, ctrl/cmd-click the blank ones, right-click → Delete Pages.
- macOS Preview: View → Thumbnails, select the offending pages, press Delete, then File → Save.
- Browser-based editors: most, including ours, show a page grid where you select and remove. The full walkthrough is in how to delete PDF pages.
Two habits make this less error-prone. Work back to front so deleting page 12 does not shift the index of the page 20 you were about to delete. And zoom the thumbnails up one size before you start — at the default size a page holding one faint line of text looks identical to an empty one.
Automated detection, for scans
For a 300-page scan where every other page might be blank, you need a rule. The standard approach is: rasterise each page, then measure how much of it is not background.
ImageMagick gives you this in one line per page:
convert -density 72 input.pdf[5] -colorspace Gray -format "%[fx:mean]" info:
That prints the mean grey level of page 6 (pages are zero-indexed). A pure white page returns 1.0. A page with a paragraph on it lands around 0.95–0.98. A blank scan with show-through and edge shadow might come in at 0.93. So the threshold matters, and you should calibrate it against your own scanner rather than trusting a number from the internet.
A more robust variant measures the standard deviation rather than the mean, because a uniformly grey blank page and a page with black text on white differ far more in variance than in average:
convert -density 72 input.pdf[5] -colorspace Gray -format "%[fx:standard_deviation]" info:
Blanks cluster near zero. Content pages do not. This survives scanners that produce a consistently dingy background, which the mean test does not.
Two refinements worth applying before you measure:
- Crop the edges. Trim 3–5 mm off each side first (
-shave 20x20at 150 dpi) to discard the scanner shadow, which otherwise makes every page look non-blank. - Deskew, if your scans come in crooked, for the same reason.
Text-based detection, for born-digital files
If the PDF came out of a word processor rather than a scanner, you do not need image analysis. Extract the text per page and check whether anything is there:
pdftotext -f 7 -l 7 input.pdf - | tr -d '[:space:]' | wc -c
Zero characters means no text on page 7. Combine it with a check for images — pdfimages -list input.pdf shows which pages carry image XObjects — and you have a solid two-part test. pdftotext and pdfimages both ship with poppler; see poppler-utils introduction.
The trap here: a page that draws only vector graphics — a rule, a box, a logo path — has no text and no images but is not blank. Rare in practice, common enough in letterhead templates to be worth knowing about.
Removing the pages you found
Once you have the list, deletion is cheap. With qpdf, describe the pages you want to keep rather than the ones you want to lose:
qpdf input.pdf --pages . 1-4,6-11,13-40 -- output.pdf
With pdftk:
pdftk input.pdf cat 1-4 6-11 13-40 output output.pdf
Both preserve the document's content faithfully. Both also drop things you may care about — outline bookmarks pointing at removed pages, and in some cases the document outline entirely. If your file has bookmarks, check them afterwards; the fix is covered in how to add bookmarks to PDF.
The scanner-side fix is better
Everything above is remediation. The real fix is to stop generating the blanks:
- Most document scanners have a blank page removal setting in the driver. Turn it on and set the sensitivity conservatively — you would rather keep a blank than drop a page with one line of handwriting on it.
- Scan single-sided originals in simplex mode. It is obvious, and it is the single biggest source of unnecessary blanks.
- If you are scanning mixed batches, sort them first. Two passes cost less than a manual clean-up of the merged output.
Verify before you delete the original
Blank-page removal is one of the few PDF operations where an automated tool can silently destroy content — a page with a single faint pencil annotation, a page with a stamp in the corner, a page that is blank in the scan but had something on it in the original. Before you overwrite anything:
- Diff the page count against what you expected.
- Spot-check the pages immediately before and after each deletion — misalignment by one is the classic failure.
- Keep the pre-clean file until the output has actually been used for something.
For long documents where a visual check is impractical, how to compare two PDFs covers tooling that will show you the difference page by page.
Summary
For a few pages, delete by hand from the thumbnail view, working back to front. For scans, measure per-page standard deviation after cropping the edges, calibrate the threshold on your own hardware, and keep the original until you have checked the result. For born-digital files, a text-and-image extraction test is faster and more reliable than looking at pixels. And if this is a recurring job, fix it at the scanner instead.