How do I add page numbers to a PDF?
You add page numbers by drawing a small text label onto each page of the PDF at the same spot. Choose your file, pick Bottom left, Bottom center or Bottom right, set the number to start from, then click Convert and download numbered.pdf. Every page receives a number, counting up by one.
The numbering is done by pdf-lib in your browser. It embeds the standard Helvetica font, writes the number onto each page's content, and saves a new file. Your original PDF is untouched and is never uploaded.
Exactly where the numbers go
PDF measures in points, where 72 points make an inch (ISO 32000-1, section 8.3.2). The tool uses fixed measurements from the bottom-left corner of the page as you see it: the visible area (the CropBox, or the full MediaBox when there is no crop), turned by the page's rotation setting:
| Setting | Horizontal placement | Vertical placement |
|---|---|---|
| Bottom left | Number starts 30 pt (10.6 mm) from the left edge | Baseline 20 pt (7 mm) above the bottom |
| Bottom center | Centered on the page, using the number's actual width | Baseline 20 pt above the bottom |
| Bottom right | Number ends 30 pt from the right edge | Baseline 20 pt above the bottom |
Text is Helvetica, 10 pt, black. Because the center position is calculated from each label's measured width, "9" and "10" both sit truly centered rather than drifting right as the digits grow. The same offsets apply to every page size, from A5 to tabloid, so on a small page the number sits proportionally further in.
The starting number
Start numbering at takes any whole number. Common uses:
1(the default) for a standalone document.2when you've removed a cover page that should count as page 1.47when this file is chapter 3 and the previous chapters ended on page 46.
Decimals are rounded down, so 2.9 starts at 2. A blank box or text that isn't a number falls back to 1. Zero and negative numbers are accepted and printed as typed, which is rarely what you want, so double-check the box before converting.
Numbering everything except the cover
This is the most common request, and it takes three quick passes. For a 12-page report whose cover shouldn't show a number:
- In Split PDF, extract page 1 to 1 and save it as
cover.pdf. - Extract pages 2 to 12 and save that as
body.pdf. - Number
body.pdfhere with Start numbering at set to2. - Combine
cover.pdfandnumbered.pdfwith the PDF merger, then check the order in the result.
The same approach handles a front section you want left alone, such as a title page and table of contents.
Things that can go wrong
Numbers overlap an existing footer. The label is drawn on top of whatever is already at the bottom of the page, with no white box behind it. Documents exported from word processors often have a footer at about the same height. Try a different position, or remove the old footer at the source.
Pages with a rotation setting. Scans often store a page sideways and set its Rotate value to 90, 180 or 270 so viewers turn it upright. The tool reads that value, puts the number along the edge that appears at the bottom on screen, and turns the text so it reads upright. If a page still looks sideways in your viewer, its content itself is sideways; fix that with Rotate PDF first, because a page you rotate after numbering takes its number with it.
Cropped pages. Placement is measured from the visible crop area, so a page trimmed with a CropBox smaller than the sheet, or one whose coordinates start somewhere other than zero, still shows its number 20 points above the visible bottom edge.
"Could not add page numbers" followed by a message saying the document is encrypted means the file has password or permission protection. pdf-lib won't open such files; remove the protection in the program that created it.
What this tool doesn't do
It doesn't do headers, top-of-page positions, "Page X of Y" labels, Bates numbering for legal discovery, or different numbering styles for different sections. It also doesn't detect a page's existing numbers, so running it twice stamps a second set on top of the first. For a long report assembled from several files, merge first, then number once, and the sequence will be continuous.
Last updated