Skip to content
DevToolKit

Add Page Numbers

Add page numbers to any PDF document with customizable position, font, size, and formatting. Supports headers and footers with flexible numbering schemes. Runs entirely in your browser — no upload required.

pdf

Drop your PDF here, or click to browse

Files are processed entirely in your browser — never uploaded

Processed locally
Was this tool helpful?

How to Use

Add page numbers to your PDF document:

  1. Upload your PDF — Drag and drop the file or click to browse. The tool previews the first page to help you position the page number.
  2. Choose position — Select where the page number appears: top-left, top-center, top-right, bottom-left, bottom-center, or bottom-right. Adjust the margin offset for fine-tuning.
  3. Configure format — Select the numbering style (Arabic, Roman, alphabetic), set the starting number, and optionally add surrounding text (e.g., "Page {n} of {total}").
  4. Set font and size — Choose the font family, size, and color for the page numbers. The preview updates in real time.
  5. Select page range — Apply numbering to all pages, or specify a range (e.g., skip the cover page by starting from page 2).
  6. Click "Add Page Numbers" — The tool stamps numbers on each selected page and generates the output PDF.
  7. Download the result — Save the numbered PDF to your device.

The page numbers are added by appending drawing instructions to each page's content stream. This overlay approach means the existing page content is never modified — the number is simply drawn on top at the specified coordinates. The technique is the same one used by professional prepress tools for imposing folio marks on print-ready PDFs.

About This Tool

Adding page numbers to a PDF involves appending text-drawing operators to each page's content stream. In the PDF imaging model, text is painted by a sequence of operators: BT (begin text), Tf (set font and size), Td (position text cursor), Tj or TJ (show text string), and ET (end text). To add a page number, the tool constructs these operators with the appropriate font reference, glyph string, and positioning coordinates, then appends them to the existing content stream as an overlay.

Positioning the page number requires understanding the page's coordinate system. PDF pages use a coordinate system measured in points (1 point = 1/72 inch) with the origin typically at the bottom-left corner of the media box. A page number placed at "bottom-center" is positioned at (mediaBoxWidth / 2, marginOffset) with the text centered using the Tc (character spacing) or by pre-calculating the string width. The tool reads each page's media box dimensions to compute the correct absolute coordinates, accounting for pages of different sizes within the same document.

Font embedding is a critical consideration when adding text to an existing PDF. The page number text requires a font resource that may not exist in the original document. The tool embeds a standard font (such as Helvetica or Times-Roman from the PDF base 14 fonts, which all PDF readers are required to support) or embeds a subset of a custom font. Using the base 14 fonts avoids increasing file size, since these fonts are built into every conforming PDF renderer. For documents requiring specific typography, the tool embeds the minimum subset of glyphs needed (the digits 0-9, any prefix/suffix characters, and optionally Roman numeral letters) to keep the size overhead negligible.

The content stream architecture in PDF separates content into a stack of graphical states. When appending page number operators, the tool wraps them in a q...Q (save/restore graphics state) pair to ensure the added text does not alter the rendering state of existing content. Without this isolation, the font selection, color, or transformation matrix set by the page number operators could affect subsequent drawing if the original content stream expects a different default state. The save/restore pattern is a standard defensive technique used by all professional PDF modification tools.

Page rotation interacts with page number placement in a way that requires careful handling. A page with /Rotate 90 (landscape) has its content stream defined in portrait coordinates, with the viewer applying a rotation transformation at render time. If the page number is added in the unrotated coordinate system, it will appear sideways when the rotation is applied. The tool detects the /Rotate value for each page and adjusts the text positioning and transformation matrix accordingly, ensuring the page number appears correctly oriented regardless of the page's rotation setting. This per-page rotation detection is essential for documents that mix portrait and landscape pages.

Why Use This Tool

Page numbers are a fundamental element of document usability and professionalism:

  • Professional document appearance — Reports, proposals, and white papers without page numbers appear unfinished. Adding consistent pagination signals attention to detail and makes the document look polished and complete.
  • Meeting reference — During meetings and presentations, page numbers enable efficient communication: "Turn to page 14" is far more effective than "scroll to the section about quarterly targets." Numbered pages reduce friction in group discussions.
  • Legal and regulatory compliance — Court filings, notarized documents, and regulatory submissions often require sequential page numbering. Some jurisdictions mandate specific numbering formats and positions for official documents.
  • Print and binding preparation — When printing and binding a document, page numbers are essential for collating pages correctly after printing, especially with duplex output where front and back pages must align. Print shops expect numbered pages for quality verification.
  • Table of contents accuracy — A table of contents is only useful when it references page numbers. Adding page numbers to a PDF that was generated without them makes any existing table of contents functional for navigation.
  • Academic standards — Thesis guidelines, conference proceedings, and journal submissions universally require page numbering. Many academic institutions specify exact formatting — "centered at the bottom, 12pt Times New Roman, starting from the introduction page."

Many PDF creation workflows — particularly scanned documents, image-based PDFs, and basic export tools — produce files without page numbers. Adding them after the fact with this tool is significantly faster than going back to the source application, adding numbers, and re-exporting. Since the tool processes files locally, it is suitable for any document regardless of confidentiality level.

FAQ

Can I start numbering from a page other than the first?
Yes. You can set a starting page (e.g., skip the cover and table of contents) and a starting number (e.g., begin numbering at 3 instead of 1). This is useful for documents with front matter that uses Roman numerals or no numbers at all.
What numbering formats are available?
The tool supports Arabic numerals (1, 2, 3), Roman numerals (i, ii, iii or I, II, III), and alphabetic labels (a, b, c or A, B, C). You can also include custom text around the number, such as "Page 1 of 10" or "- 1 -".
Does adding page numbers modify the original content?
The numbers are added as an overlay on each page. The existing content remains completely unchanged — no text is moved, resized, or reformatted. The page number is drawn on top of the existing content stream at the specified position.
Is this processed locally?
Yes. The page number insertion is performed entirely in your browser using pdf-lib. Your PDF is never uploaded to any server, making this safe for confidential documents.