inyourbrowser.com

Trim PDF Margins

Cut away the empty white space around the body of a PDF. Drop the file, drag a rectangle to mark where the content starts and ends, and download a tightened copy. Useful for scanner output or PDFs with wide default margins. All processing runs in your browser.

Drop a PDF here or click to browse

How it works

The first page is rendered via pdfjs-dist so you can see exactly where the body of the document sits. You drag the rectangle around the content you want to keep; the tool converts the canvas pixel rectangle into PDF user-space coordinates and resizes every page (or just the first, if you prefer) to it by setting both the MediaBox and CropBox using pdf-lib.

Processing runs in your browser

All cropping happens inside your browser tab. The preview is rendered with pdfjs-dist and the cropped PDF is written by pdf-lib in memory; our servers are not involved at any point. You can verify this yourselfin your browser's DevTools Network tab.

Related operations

To reduce file size after cropping, try compress PDF. To rotate pages before cropping, use rotate PDF. For per-page cropping, split first with split PDF.

Frequently asked questions

How is margin trimming different from cropping?
They are the same operation: both resize the page to a chosen rectangle. Trimming margins usually means cropping tight around the body content to remove white space, which makes the document feel more compact on screen.
Will the result print correctly?
Yes. Each cropped page is resized to the crop rectangle (both the MediaBox and CropBox are set to it), so every viewer and printer treats the cropped region as the actual page. The content outside the rectangle is clipped, and the page prints at the new, smaller size.
Can I crop a scanned PDF with skewed pages?
The crop rectangle is axis-aligned, so it cannot correct skew. Use a deskew step before cropping for best results. The tool itself works fine on straight scans.
Does cropping change the page numbers or layout?
No. Page count, page order, and the content within the crop region are unchanged. Only the page size shrinks to the crop rectangle.
Is my PDF private?
Your PDF stays in your browser. The Canvas API renders the first page, pdf-lib writes the cropped output locally, and nothing is sent to our servers.

Related tools

Compress PDF
Reduce PDF file size in your browser. Lossless optimisation or image re-rendering.
Rotate PDF
Rotate or flip PDF pages 90°, 180°, or 270°. Adjust individual pages or all at once.
Split PDF
Extract specific pages or page ranges from any PDF. Download the result instantly.
PDF to Image
Convert PDF pages to JPEG or PNG images. Download individually or all at once.