Split PDF Files Online: A Step-by-Step Guide
Splitting a PDF file means dividing it into multiple smaller documents — extracting specific pages, separating every N pages, or splitting by custom page ranges. Whether you need to send only certain pages of a contract, extract a chapter from an ebook, or divide a scanned document into individual files, an online PDF splitter lets you do it instantly without installing software.
Why You Might Need to Split a PDF
- Extract a few pages from a large document to share via email
- Separate a multi-page contract into individual signature pages
- Divide a scanned book into chapters
- Split a portfolio into separate project files
- Extract an invoice from a monthly statement
- Remove unwanted pages before merging with another PDF
Splitting Methods
Method 1: Extract Specific Pages
Select the exact page numbers you want to extract as a new PDF file. Page ranges use the format 1-5, 8, 11-13.
Input: 100-page document
Extract: 1-5, 8, 11-13
Output: 8 pages (1,2,3,4,5,8,11,12,13) in a new PDF
Method 2: Split Every N Pages
Split a document into chunks of N pages each. This is useful for dividing a large PDF into smaller files of equal size.
Input: 50-page document
Split: every 10 pages
Output: 5 files (pages 1-10, 11-20, 21-30, 31-40, 41-50)
Method 3: Split by Custom Page Ranges
Define each output file with its own page range. Each range becomes a separate PDF.
Input: 30-page document
Split ranges: 1-5, 6-15, 16-20, 21-30
Output: 4 files
How the PDF Splitter Tool Works
The PDF Splitter tool on Help2Code runs entirely in your browser using PDF.js. Your file never leaves your device — no upload to a server, no privacy concerns.
Step-by-Step Instructions
- Open the PDF Splitter tool in your browser
- Click the upload area or drag and drop a PDF file onto it
- Select the split method: extract specific pages, split every N pages, or custom ranges
- Configure the output: enter page numbers, interval, or ranges
- Download the result: each split section is generated and downloaded automatically
Code Examples
JavaScript: Split PDF Using pdf-lib
const { PDFDocument } = require('pdf-lib');
async function splitPdf(sourceBytes, pageRanges) {
const sourceDoc = await PDFDocument.load(sourceBytes);
const outputDocs = [];
for (const range of pageRanges) {
const newDoc = await PDFDocument.create();
const [start, end] = range;
const copiedPages = await newDoc.copyPages(
sourceDoc,
Array.from({ length: end - start + 1 }, (_, i) => start + i)
);
copiedPages.forEach(page => newDoc.addPage(page));
outputDocs.push({
pages: `${start + 1}-${end + 1}`,
bytes: await newDoc.save()
});
}
return outputDocs;
}
// Usage: extract pages 1-3 and 5-7 (0-indexed)
const ranges = [[0, 2], [4, 6]];
splitPdf(pdfBuffer, ranges).then(console.log);
Python: Extract Pages with PyMuPDF
import fitz # PyMuPDF
def extract_pages(input_pdf: str, output_pdf: str, page_numbers: list[int]):
src = fitz.open(input_pdf)
dst = fitz.open()
for num in page_numbers:
dst.insert_pdf(src, from_page=num, to_page=num)
dst.save(output_pdf)
dst.close()
src.close()
extract_pages('input.pdf', 'output.pdf', [0, 1, 4, 5])
# Extracts pages 1, 2, 5, 6 (0-indexed)
PHP: Split PDF with FPDI
use setasign\Fpdi\Fpdi;
function splitPdf(string $inputFile, array $pageRanges): array {
$outputFiles = [];
$pdf = new Fpdi();
$pageCount = $pdf->setSourceFile($inputFile);
foreach ($pageRanges as $i => $range) {
$output = new Fpdi();
[$start, $end] = $range;
for ($page = $start; $page <= $end; $page++) {
$templateId = $output->importPage($page);
$size = $output->getTemplateSize($templateId);
$output->addPage($size['orientation'] === 'L' ? 'L' : 'P', [$size['width'], $size['height']]);
$output->useTemplate($templateId);
}
$filename = tempnam(sys_get_temp_dir(), "split_$i") . '.pdf';
$output->Output($filename, 'F');
$outputFiles[] = $filename;
}
return $outputFiles;
}
$ranges = [[1, 3], [5, 7]]; // 1-indexed pages
splitPdf('input.pdf', $ranges);
Command Line: Using pdfseparate (Linux)
# Split every page into individual files
pdfseparate input.pdf output_%d.pdf
# Split into ranges using pdfjam
pdfjam input.pdf 1-5 --outfile part1.pdf
pdfjam input.pdf 6-10 --outfile part2.pdf
Comparing PDF Splitting Tools
| Tool | Platform | Privacy | Max Pages | Output Options |
|---|---|---|---|---|
| Help2Code PDF Splitter | Browser | 100% client-side | Limited by browser | By range, every N, custom |
| Adobe Acrobat | Desktop | Full privacy | Unlimited | Split by size, pages, bookmarks |
| pdfseparate | Linux CLI | Full privacy | Unlimited | Every page to separate file |
| PyMuPDF | Python | Full privacy | Unlimited | Full programmatic control |
| Online upload tools | Web | Upload required | Varies | By range or every N |
Best Practices
- Check privacy policies — Use client-side tools for sensitive documents
- Verify page ranges — Double-check your page numbers before splitting
- Keep original backups — Never split the only copy of an important document
- Review output files — Open each split file to confirm it contains the expected pages
- Name files clearly — Use descriptive names like
contract-signature-page.pdfinstead ofoutput1.pdf
Related Tools
After splitting, you might need to compress PDF files to reduce file size, remove pages from a document, or merge multiple PDFs back together. All these tools run in your browser with no upload required.
Conclusion
Splitting PDF files is a common document task that every professional encounters. Whether you need to extract specific pages, divide a document into equal parts, or create custom page ranges, an online PDF splitter makes the process instant and privacy-safe. Use the PDF Splitter tool for browser-based splitting, and explore the programmatic approaches above for automated document processing.