Remove blank pages from a PDF
Removing blank pages means detecting and deleting the empty pages a scanner inserts, most often the backs of one-sided sheets scanned in duplex mode. This tool renders every page of the PDF in your browser, measures the proportion of dark pixels on each one, and deletes the pages that fall below the blankness threshold of the sensitivity level you choose — strict, normal or aggressive. The cleaned file is rebuilt locally and never uploaded.
How it works
A “blank” scanned page is almost never digitally blank. The sheet passes a real optical sensor, so the resulting image carries paper texture, dust specks, hole-punch shadows, edge darkening from the feeder rollers, and often faint show-through of the ink printed on the other side. A naive check for a pure-white page would keep every one of them. Detection therefore has to be statistical: how much of this page is actually dark, and is that amount consistent with an empty sheet?
The tool renders each page to a canvas with pdf.js, reads the pixel data back, and computes the luminance of every pixel. Pixels darker than a fixed cutoff count as ink; the page's score is the ratio of ink pixels to total pixels. That score is compared with the threshold of the sensitivity level you selected. Strict removes only pages that are almost perfectly clean, normal tolerates typical scanner noise, and aggressive also discards pages carrying stronger artifacts such as visible bleed-through or heavy punch shadows — at a higher risk of catching a nearly-empty real page, like one holding only a page number.
Once the blank pages are identified, pdf-lib builds the output by copying every kept page — completely unchanged, including its original image compression — into a new document. Rendering is used purely for measurement, so the surviving pages lose no quality and the file simply gets smaller. The classic use case is a stack of one-sided paperwork fed through a duplex scanner: every sheet arrives as a content page followed by an empty back, and this tool strips the backs in one pass. If your problem is the opposite — front sides and back sides scanned as two separate files — use the interleave tool to zip them together instead.
Worked example: a duplex scan of one-sided paperwork
Thirty single-sided invoice sheets went through an office scanner set to duplex, producing a 60-page, 24.6 MB PDF in which every even page was an empty back. At normal sensitivity the tool flagged 29 of those 30 backs; one survived because ink from a heavily printed front had bled through strongly enough to score above the threshold. Re-running at aggressive sensitivity caught it too, while all 30 content pages stayed comfortably above the cutoff — a typical invoice page measured around 4% dark pixels against blank backs at 0.1% or less. The final file had exactly 30 pages and shrank to 12.1 MB, with every kept page bit-identical in quality to the original scan.
Frequently asked questions
How does the tool decide that a page is blank?
Each page is rendered to an image and the share of dark pixels is measured. If that share stays below the threshold of the sensitivity level you picked, the page counts as blank and is removed.
Why did a page with faint show-through survive detection?
Ink bleeding through from the other side of the sheet raises the dark-pixel ratio just enough to clear the normal threshold. Switch to the aggressive sensitivity level, which tolerates more marks before keeping a page.
Will a page that only contains a page number be deleted?
It can be, because a lone page number covers a tiny fraction of the page area and may fall under the aggressive threshold. If your document has nearly-empty pages you want to keep, use the strict level and review the list of removed pages before downloading.
Does removing blank pages recompress the remaining pages?
No. The kept pages are copied into the new file unchanged, byte for byte at the object level, so their images, text and quality are untouched. Rendering is used only to measure blankness, never to rebuild content.
Why does my scanner insert blank pages in the first place?
Document feeders scanning in duplex capture both sides of every sheet, so each one-sided original contributes an empty back side. Scanning a stack of single-sided paperwork in duplex mode therefore doubles the page count with blanks.
Is my scanned PDF uploaded to detect the blank pages?
No. Rendering, measuring and rebuilding all happen locally in your browser with JavaScript, and the file never leaves your device.