induwara.lk
induwara.lkDocuments · Privacy-first

Split PDF

Split a PDF into multiple files by page range, every N pages, or one PDF per page — fully inside your browser, no signup, no upload. Each output keeps the original pages byte-identical; nothing is re-rasterised. Sources cited.

By Induwara AshinsanaUpdated May 11, 2026
PDF SplitterIn-browser · no upload
Files stay on your device

Everything happens in your browser. Nothing is uploaded.

Built against the ISO 32000-2 PDF 2.0 specification, using pdf-lib for the page-tree surgery. Header, EOF, and plan integrity checks verified 2026-05-11 — full source list in the "Sources & references" section below.

How it works

A PDF file is, in spec terms, a body of numbered objects (pages, fonts, images, content streams) plus a cross-reference table that tells a reader the byte offset of each object. The page tree (ISO 32000-2 §7.7.3.2) is a shallow structure: a root /Pages dictionary points to /Kids (each a /Page object), and the catalog points to that root. To split a PDF you copy a subset of the page objects — together with everything they reference (fonts, images, resources, content streams) — into a fresh document and rebuild a single page-tree root over the lot. That is what this tool does for every output range.

The split is performed by pdf-lib, an MIT-licensed pure-JavaScript PDF library. It is loaded dynamically when you press Split — until then the page bundle stays small and your browser does not download the ~270 KB library. Inside the React component the flow is straight: PDFDocument.load(bytes) for the source, then for each output range a fresh PDFDocument.create() plus copyPages(src, [i..j]).addPage(...), and finally save() to serialise each output.

Before any pdf-lib work runs the tool does four deterministic things so the plan can be validated up front:

  1. Validate the source. Confirms the PDF MIME type, a non-zero size, and a per-file cap of 100.0 MB. The first 1 KB is scanned for the literal %PDF-n.m header (ISO 32000-2 §7.5.2), and the last 2 KB for the %%EOF terminator (§7.5.5). Files missing either are rejected with an explanation.
  2. Read the exact page count. pdf-lib parses the catalog and page tree and reports getPageCount(). That number is the ceiling for every range the user enters — an out-of-bounds range becomes an inline error before the split runs.
  3. Build a plan. The selected mode produces a list of output ranges. By-range mode parses the text expression; every-N mode walks for (start = 1; start ≤ total; start += N); each-page mode produces N ranges of one page each. Plans are capped at 500 output files.
  4. Cross-check the plan. The plan is summed two ways. First by arithmetic (end − start + 1, totalled), then by independent enumeration (a nested loop that adds 1 per page visited). The two totals must agree and every page must lie inside the source. If anything is off, the Split button is disabled with a specific error.
  5. Run the split. For each range, pdf-lib creates a destination document, copies the selected pages (preserving the original byte streams), writes a fresh catalog and trailer, and returns the merged byte buffer. Each buffer is wrapped in a Blob, exposed via an object URL, and offered to you as a download. No bytes leave the browser tab.

Worked examples

Extract chapters by range

A 10-page PDF with three chapter starts at pages 1, 5, and 7. Extracting each chapter as its own file uses three ranges.

  1. Source: 10 pages · mode: Ranges: 1-3, 5, 7-9
  2. Output files (3): Pages 1–3 · Page 5 · Pages 7–9
  3. Pages copied: 7 of 10
  4. Pages 4, 6, and 10 are dropped — not every page has to belong to an output. Total pages copied = 3 + 1 + 3 = 7.

Every 5 pages of a 20-page report

A 20-page quarterly report split into four 5-page sections. Uses the 'every N pages' mode with N = 5.

  1. Source: 20 pages · mode: Every 5 pages
  2. Output files (4): Pages 1–5 · Pages 6–10 · Pages 11–15 · Pages 16–20
  3. Pages copied: 20 of 20
  4. ceil(20 / 5) = 4 outputs. Page counts are 5 + 5 + 5 + 5 = 20, matching the source exactly.

Every 7 pages of a 20-page handbook (non-divisible)

A 20-page staff handbook split into 7-page chunks. 20 is not a multiple of 7, so the last output is shorter.

  1. Source: 20 pages · mode: Every 7 pages
  2. Output files (3): Pages 1–7 · Pages 8–14 · Pages 15–20
  3. Pages copied: 20 of 20
  4. ceil(20 / 7) = 3. The last output has just 6 pages (15–20). Total copied = 7 + 7 + 6 = 20, no pages dropped.

Frequently asked questions

Sources & references

Related tools

Rate this tool
Be the first to rate

Comments & feedback

Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.

Found a bug, edge case, or want to suggest an improvement?

Email me at [email protected] — most fixes ship within 24 hours.