How to Split a PDF Online for Free (No Upload Needed)
Splitting a PDF — extracting a chapter, isolating a single page, or separating a scanned invoice from a contract — is one of the most frequent document tasks. The good news: you can do it entirely in your browser without uploading to a third-party server, or from the command line in a single command.
Method 1 — Browser-based (no upload)
DevBench's PDF Splitter runs entirely in your browser using PDF.js. Your file is never uploaded to any server:
- Open the DevBench PDF Splitter
- Drop your PDF or click to browse
- Enter the page range — for example
1-3to extract the first three pages, or5,8,12for individual pages - Click Split — the resulting PDF downloads directly to your device
Because everything runs client-side, this is safe for confidential documents. There are no file size limits imposed by upload quotas (only browser memory).
Page range syntax
| Input | Result |
|---|---|
1-5 | Pages 1 through 5 (inclusive) |
3 | Page 3 only |
1,3,7 | Pages 1, 3, and 7 (non-contiguous) |
2-4,9-12 | Pages 2–4 and pages 9–12 |
-3 | Pages 1 through 3 (shorthand) |
Method 2 — macOS Preview (built-in)
- Open the PDF in Preview
- Open the Thumbnails sidebar (View → Thumbnails)
- Select the pages you want to extract (Cmd+click for non-contiguous pages)
- Drag the selected thumbnails out of the window to your Desktop — this creates a new PDF with just those pages
Alternatively, print to PDF: select the pages you want, choose File → Print, set the page range, then click PDF → Save as PDF.
Method 3 — Python (pypdf)
pypdf is the standard Python library for PDF manipulation. Install it with pip install pypdf:
from pypdf import PdfReader, PdfWriter
reader = PdfReader("input.pdf")
writer = PdfWriter()
# Extract pages 3–7 (0-indexed: 2–6)
for page_num in range(2, 7):
writer.add_page(reader.pages[page_num])
with open("extracted.pdf", "wb") as f:
writer.write(f)
print(f"Extracted {len(writer.pages)} pages")To split into individual single-page PDFs:
from pypdf import PdfReader, PdfWriter
reader = PdfReader("input.pdf")
for i, page in enumerate(reader.pages):
writer = PdfWriter()
writer.add_page(page)
with open(f"page_{i+1}.pdf", "wb") as f:
writer.write(f)Method 4 — Ghostscript (command line)
# Extract pages 3 to 7
gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dFirstPage=3 -dLastPage=7 -sOutputFile=extracted.pdf input.pdf
# macOS/Linux — single page (page 5)
gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dFirstPage=5 -dLastPage=5 -sOutputFile=page5.pdf input.pdfGhostscript is pre-installed on many Linux distributions. On macOS, install with brew install ghostscript.
Handling password-protected PDFs
If the PDF is password-protected, you need to supply the password before splitting:
from pypdf import PdfReader, PdfWriter
reader = PdfReader("protected.pdf")
if reader.is_encrypted:
reader.decrypt("your-password")
# Now proceed with splitting normallyWhen the file size is unexpectedly large after splitting
A PDF may embed fonts and images once for the whole document. When you extract a few pages, each output file may still include those full embedded resources. To optimise file size after splitting, run the output through a PDF compressor or use Ghostscript with the -dPDFSETTINGS=/ebook flag.
Try it yourself
Use the free browser-based PDF Splitter on DevBench — no signup, runs entirely in your browser.
Open PDF Splitter