PDFCloak
LOCAL
HomeAdd Page Numbers

Add Page Numbers

Number your pages with customizable position and format.

In-browserNo upload

This tool adds page numbers to any existing PDF — free, in your browser, with the file never uploaded anywhere. You control where the numbers land, how they look, and where counting starts. Numbering sounds trivial until you try to do it after a document is already assembled: word processors handle it automatically, but once content becomes a PDF, those automatic numbers are baked into the page content — or missing entirely.

Local-only session
Files processed inthis browser tab
Bytes sent to server0 / 0
Tab close discardseverything
Enginepdf-lib · client-side

This tool adds page numbers to any existing PDF — free, in your browser, with the file never uploaded anywhere. You control where the numbers land, how they look, and where counting starts. Numbering sounds trivial until you try to do it after a document is already assembled: word processors handle it automatically, but once content becomes a PDF, those automatic numbers are baked into the page content — or missing entirely.

When to use this tool

You have a PDF that lacks page numbers and needs them. The most common situations:

  • A merged document assembled from multiple sources that now needs continuous numbering
  • A scanned booklet where page numbers were cut off during scanning
  • Legal filings that require specific numbered formatting (Bates numbering is a specialized variant, but simple sequential numbers satisfy many court requirements)
  • Manuals or reports distributed as PDF that need numbers for reference in meetings ("turn to page 14")
  • Academic papers where the cover page and abstract should use Roman numerals and the body uses Arabic numbers

You might also use this to re-number a document after reordering or deleting pages. If you rearranged a 40-page PDF and the original numbers no longer match reality, strip the header/footer area and apply fresh numbers.

How page numbering works in PDF

Adding a page number to a PDF means drawing text at a specific position on each page's content stream. The mechanics are straightforward but require understanding PDF's coordinate system.

Coordinate system basics. PDF measures from the bottom-left corner of the page. The x-axis runs right, the y-axis runs up. Units are points (1/72 inch). A US Letter page is 612 points wide and 792 points tall. So "bottom-center" means x = 306, y = approximately 30 (half an inch up from the bottom edge). "Top-right" means x = approximately 580 (half an inch from the right edge), y = approximately 762 (half an inch down from the top).

Appending drawing operators. For each page, we open the existing content stream and append a sequence of operators:

  1. q — Save the current graphics state so we do not disturb anything.
  2. BT — Begin a text object.
  3. Tf — Set the font and size (e.g., /Helvetica 10 Tf).
  4. rg — Set the fill color for the text (e.g., 0.3 0.3 0.3 rg for dark gray).
  5. Td — Move to the target position (e.g., 306 30 Td for bottom-center on a letter page).
  6. Tj — Draw the number string (e.g., (7) Tj for page 7).
  7. ET — End the text object.
  8. Q — Restore the graphics state.

That is all it takes. Eight operators per page, each one a few bytes. The entire operation adds trivial size to the file.

Handling the font resource. The text operator Tf references a font name that must exist in the page's resource dictionary. Standard PDF fonts (Helvetica, Times-Roman, Courier) are always available. We add a font reference to the page's /Resources dictionary if one does not already exist, pointing to a standard Type1 font.

Centering text. When the position is set to center, we need to know the width of the number string to offset it by half. PDF standard fonts have well-defined character widths published in the specification. For the string "14" in Helvetica at 10pt, we calculate: width of "1" (556 units/1000) plus width of "4" (556 units/1000) = 1112 units, scaled by 10/1000 = 11.12 points. We shift left by 5.56 points from the center coordinate.

Format tokens. Beyond plain numbers, our tool supports format strings like "Page {n} of {total}" or "- {n} -". The {n} token is replaced with the current page number (respecting the start offset), and {total} is replaced with the total page count. Roman numeral and letter formats apply a conversion function to the number before insertion.

Common issues

Numbers overlapping footer content. If the original PDF has text, images, or design elements near the bottom edge, a page number placed there will overlap. There is no reliable way to detect where existing content ends — PDFs do not have semantic "margins." You have to choose a position that avoids collision, either by inspection or by using generous margins (50+ points from the edge).

Mixed orientation pages. A document with some portrait and some landscape pages needs different coordinate calculations for each. A bottom-center number on a portrait page (x=306, y=30) would appear in the wrong spot on a landscape page (which might be 792 points wide and 612 points tall). Our tool reads each page's MediaBox and Rotate value to compute the correct visual position.

Page rotation flags. Some PDFs have pages stored in one orientation but displayed in another using the /Rotate dictionary entry. A page might be stored as landscape (wider than tall) but have /Rotate 90, making it display as portrait. We account for this by transforming our coordinates according to the rotation value.

Starting number mismatches. If you set "start at 1" but skip the first two pages, page 3 of the document gets number 1, page 4 gets number 2, and so on. This is correct behavior — but easy to confuse with a bug if you expected the physical page position to match the printed number.

Small font sizes on high-DPI screens. A 9-point page number looks reasonable on paper but might appear tiny when viewing the PDF at 100% zoom on a high-resolution display. This is a display issue, not a rendering issue. At print resolution, 9pt text is perfectly legible.

What to expect from our tool

You pick a position (top or bottom; left, center, or right), a format (Arabic, Roman, letters, or a custom template), margins from the page edge, font size, font family, and color. The preview updates live as you adjust settings.

Processing is nearly instant regardless of document length. Adding numbers to a 500-page PDF takes under a second because the operation involves appending a tiny text block to each page's content stream — no re-rendering, no image processing.

The output PDF is byte-for-byte identical to the input except for the added text operators and any new font resource entries. Bookmarks, links, form fields, annotations, and embedded files are all preserved untouched.

After numbering, the new page numbers are real text in the PDF. They can be selected, copied, and found with Ctrl+F. Screen readers will announce them. They are not burned-in images.

One scenario this tool handles gracefully: documents with pages of different sizes. A report with letter-size body pages and A3 foldout diagrams gets correctly positioned numbers on every page, because coordinates are computed per-page rather than once for the whole document.

Related tools
What the tool does

Built for documents you can't afford to lose.

Runs in your browser
No server round-trip. Your file is processed by WebAssembly right in this tab.
Preserves quality
No re-encoding by default. Structure, links, and metadata survive intact.
Nothing to leak
Files never leave your device. Close the tab and everything is gone.
Add Page Numbers · FAQ

About this tool, specifically.