PDF Margin Crop — Auto-Trim White Borders

Automatically detect and remove white border margins from every page of your PDF. Fine-tune with the padding slider. 100% in-browser — your files never leave your device.

📄
Drop PDF here or click to browse
Single PDF file · processed entirely in your browser
8 pt

How it works

1
Render to canvas
Each page is rasterized at 72 dpi using pdf.js so pixel colors can be inspected.
2
Scan for content
Every row and column is tested for non-white pixels. The tightest bounding box around all content is recorded.
3
Convert to PDF units
Pixel coordinates are mapped back to PDF points (pt). Your chosen padding is added on all four sides.
4
Rewrite CropBox
pdf-lib sets a CropBox on each page to the trimmed rectangle. The underlying content is untouched — the crop is non-destructive.

The CropBox is the standard PDF mechanism for declaring the visible area of a page. All major PDF viewers (Preview, Acrobat, Chrome, browsers) honor it. The original page data remains intact inside the file, so you can restore the full page in any editor.

Frequently asked questions

Does cropping with a CropBox actually delete the white borders?
No — and that is intentional. A CropBox tells PDF viewers which region to display and print, hiding the borders without erasing them. This is the safest, most reversible approach. If you need the white area physically removed (smaller file size by trimming the media box), you can open the result in Adobe Acrobat or PDF Expert and use "Save As" to flatten the CropBox into the MediaBox. For the vast majority of use cases — printing, reading, sharing — a CropBox crop is indistinguishable from a destructive crop.
Why might some pages say "no crop needed" or be skipped?
If pdf.js detects that the page content already fills the page right to its edges (within the white threshold), there is no margin to remove. This often happens with pages that have a colored background, full-bleed images, or pages that are already tightly cropped. The tool will still include those pages unchanged in the output PDF.
What does the "white threshold" setting do?
Pixels with all RGB channels at or above the threshold are treated as "white" (background). The default of 230 handles off-white or cream-colored paper. If your document has a grey background or faint watermarks you want to preserve, lower the threshold so those pixels are treated as content, not background. Conversely, if light scan artifacts are preventing detection, raise the threshold.
Is it safe to use this tool with confidential documents?
Yes. The entire operation runs inside your browser tab using JavaScript. No data is transmitted to any server. You can disconnect from the internet after loading the page and the tool will continue to work. This makes it suitable for contracts, medical records, legal filings, or any sensitive material.
Are there any file size or page count limits?
There are no hard limits enforced by the tool. Practical limits depend on your device's RAM — each page is rasterized into memory as a canvas. As a rough guide, a 50-page A4 PDF scanned at moderate quality will typically process in 10–30 seconds on a modern laptop. Very large or high-resolution PDFs may take longer or cause browser slowdowns on low-memory devices. If you hit issues, try processing the file in smaller chunks using the PDF Page Picker first.
Why add extra padding after trimming?
Text and graphics on a page often run very close to the true content edge. Cropping to exactly the detected bounding box with zero padding can cut off letters, descenders, or thin lines. Adding 8–16 pt of padding (the default is 8 pt) gives a clean visual breathing room while still eliminating the large white margins that prompted the crop in the first place. 1 pt = 1/72 inch ≈ 0.35 mm.