How to Merge PDFs Online for Free (Browser, macOS, CLI)
Merging PDFs is one of those tasks that sounds trivial until you realise your options are: install Adobe Acrobat (expensive), upload files to a random website (risky), or use a command-line tool (overkill for a quick task). This guide covers all three approaches — and explains when each makes sense.
Why merge PDFs?
- Contracts and agreements — combine the main document with attachments into one file before signing
- Invoices and receipts — merge multiple monthly invoices into one for expense reports
- Portfolio or report submissions — universities and employers often require one PDF upload
- Scanned documents — a scanner that produces one PDF per page needs merging before sharing
- Presentations — combine slide deck exports from multiple contributors
Online vs desktop vs command line
| Method | Pros | Cons |
|---|---|---|
| Online tool (browser-side) | No install, works on any OS, files never leave your device | Depends on browser PDF libraries |
| Online tool (server-side) | Handles large files, richer features | Files uploaded to a third-party server — privacy risk |
| Adobe Acrobat | Full-featured, reliable | Paid subscription, overkill for occasional use |
| macOS Preview | Built-in, free, fast | macOS only |
| Ghostscript (CLI) | Free, scriptable, handles any file size | Command-line setup required |
The privacy question
Before you drag your bank statements or NDA into an online tool, check whether processing happens in your browser or on their server. A tool that runs in the browser — using JavaScript libraries like pdf-lib or pdf.js — never transmits your files. A server-side tool receives, processes, and (ideally) deletes your file, but you're trusting their infrastructure and privacy policy.
Look for explicit "processed in your browser" language, or check the browser's network tab while merging — if no file upload request appears, processing is local.
How to merge PDFs in your browser (DevBench)
- Open DevBench PDF Merger — no account needed
- Click Add PDFs or drag and drop your files into the upload zone
- Reorder pages by dragging the thumbnail list — put them in the sequence you want in the final document
- Click Merge PDFs
- Download the combined file — it's generated entirely in your browser using pdf-lib
Your files are never sent to a server. The download happens client-side and the result exists only in your browser memory until you save it.
Merge PDFs on macOS (Preview)
- Open the first PDF in Preview
- Go to View → Thumbnails to show the page sidebar
- Drag additional PDF files into the sidebar at the position where you want them inserted
- Go to File → Export as PDF to save the merged document
This works for any number of files. Drag pages between positions to reorder before exporting.
Merge PDFs with Ghostscript (command line)
Install Ghostscript (brew install ghostscript on macOS, apt install ghostscript on Ubuntu), then:
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite \ -sOutputFile=merged.pdf \ file1.pdf file2.pdf file3.pdf
Ghostscript recompresses content during merge, which can slightly reduce quality on image-heavy PDFs. Use -dCompatibilityLevel=1.7 -dPDFSETTINGS=/prepress to preserve quality:
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite \ -dCompatibilityLevel=1.7 -dPDFSETTINGS=/prepress \ -sOutputFile=merged.pdf \ file1.pdf file2.pdf file3.pdf
Merge PDFs with Python (pypdf)
from pypdf import PdfWriter
writer = PdfWriter()
for filename in ["file1.pdf", "file2.pdf", "file3.pdf"]:
writer.append(filename)
with open("merged.pdf", "wb") as output:
writer.write(output)Install with pip install pypdf. This is ideal for batch merging in scripts — merge hundreds of files in a loop.
Common problems and fixes
| Problem | Cause | Fix |
|---|---|---|
| Merged file is very large | High-res images in source PDFs | Compress first, then merge; or use /screen setting in Ghostscript |
| Fonts look wrong | Fonts not embedded in source PDF | Regenerate source PDFs with embedded fonts |
| Pages appear rotated | PDF rotation metadata mismatch | Rotate pages before merging using a PDF editor or tool |
| Password-protected PDF fails | Encrypted PDFs can't be merged without the password | Unlock the PDF first (requires the password) |
Try it yourself
Use the free browser-based PDF Merger on DevBench — no signup, runs entirely in your browser.
Open PDF Merger