A PDF page counter is a read-only tool that opens a single PDF, reads its document page tree, and reports the exact number of pages the file contains along with the width and height of each page in PDF points. The count comes from the structural page array inside the PDF, not from printed sheet settings, thumbnail previews, or visible page-number labels, so a 30-page contract that prints "1, 2, 3, 1, 2, 3" on each physical sheet still counts as 30 pages. Beyond the total, a counter can also group pages by identical width-and-height pairs, which makes it useful for spotting a cover sheet, a foldout, or an accidental page-size change inside an otherwise uniform document. The PDF Page Counter on Lizely follows this definition: it opens a local PDF up to 25 MiB, reads the page tree in the current browser tab, and reports the total plus each grouped page-box dimension without uploading or modifying the file. It is the right tool when the question is the structural page count and the size inventory, and the wrong tool when a new or modified file is required.

What a PDF Page Counter Actually Counts
A PDF stores its pages as a tree inside the document body. The root pages node points to each individual page object, and the total page count equals the length of that array. Tools that count PDF pages read this structural array directly. According to the pdf-lib API documentation for PDFDocument.getPageCount, the count is the number of pages in the document's page tree, which is the authoritative source.
This matters because several things people associate with "the page count" are actually decoupled from the structural count. A document can display page-number labels that start at "3" because the cover is unnumbered, use Roman numerals for a front matter, or repeat a sequence across physical sheets when the file is printed duplex. None of those labels change the page array. A counter that respects the structural count will return the same total regardless of how the file is paginated on screen or on paper.
The same principle applies to file size, thumbnail count, and printed sheet estimates. A 12 MiB PDF is not necessarily longer than an 800 KiB one, a thumbnail grid can show previews that the document does not contain, and duplex printing halves the number of physical sheets but does not halve the number of PDF pages. A structural counter ignores all of those estimates and returns the page tree length as it exists in the file.
Why Page-Box Dimensions Are Reported Alongside the Count
Every page in a PDF carries a page box that defines its visible width and height. Those values are expressed in points, where the PDF defines its own geometry rather than the monitor or printer. The pdf-lib API exposes those values through PDFPage.getSize, returning the current page-box dimensions as the document reports them.
Reporting the page count alone hides an important class of problems. A PDF assembled from several sources can include a cover sheet in one size, body pages in another, and a foldout in a third. A counter that only returns "42 pages" cannot tell you whether the file is internally consistent or whether a single page quietly shifted to a different size during assembly. Grouping identical dimensions turns the page count into a size inventory, which makes mixed-size situations visible at a glance.
Mixed-Size PDFs and First-Seen Grouping
The counter reads the page box for every page and rounds each width and height to at most two decimal places for display. Equal displayed sizes are then collapsed into a single row, in the order they first appeared in the page tree. If the file's first three pages share one box, the next two share another, and the last page uses a third, the result lists three rows rather than six.
The tool does not assign paper-standard labels such as "A4" or "Letter" to those rows. Doing so would require orientation and tolerance decisions, and the counter deliberately avoids those decisions so that the output reflects the file rather than an interpretation of it. Two pages at 612 by 792 points appear as a single grouped row with a count of two, not as "two US Letter pages," because the file is the only authority the tool consults.
Rotation, Orientation, and Display vs Geometry
Rotation metadata in the PDF can change how a viewer presents a page on screen, but the page-box width and height are unchanged by that rotation. The counter reports the page-box values as the document library returns them, so a page rotated 90 degrees still shows the same width and height it would in its unrotated form. This keeps the size inventory aligned with the document's stored geometry rather than with a transient display rotation, and the file itself is not rewritten to "fix" the rotation.
How to Count Pages and Group Dimensions in a PDF
The procedure below runs entirely in the current browser tab and produces a result without saving a new file or sending the PDF anywhere.
- Choose a non-empty PDF no larger than 25 MiB. Use the file picker to select a single PDF from your device. Files outside that size range, empty selections, or non-PDF files will not produce a count.
- Wait for the browser to read the document page tree. The page tree is read locally; once the browser finishes loading, the page count and the dimension grouping appear on the same page.
- Review the total page count and each grouped page-box dimension. Each row in the grouping lists a width and height in PDF points and the number of pages that share those values, in first-seen order.
Selecting another file clears the previous result before processing begins, and a job identifier prevents an older slow read from overwriting the output of a newer selection. The displayed count always belongs to the file currently named on the page, and the original bytes on disk are not touched.
Reading the Results: Total Pages and Size Groups
The output has two parts. The first is a single integer: the total number of pages the document's page tree contains. The second is a list of grouped sizes. Each row holds a width, a height, and a count, and rows appear in the order the matching pages first appeared in the document.
Consider a PDF that contains two pages at 612 by 792 points and one page at 400 by 500 points. The total is three pages, and the grouping lists two rows: one for the 612 by 792 box with a count of two, and one for the 400 by 500 box with a count of one. The numbers themselves come straight from the file, so the same input always produces the same output, and the dimensions are document geometry rather than a quality score.
| What the counter reports | What it ignores |
|---|---|
| Total structural pages from the page tree | Visible page-number labels, including offsets and Roman numerals |
| Width and height of each page's current box, in points | File size as an estimate of length |
| Grouped identical page-box dimensions, in first-seen order | Thumbnail counts from a viewer preview |
| A read-only result on the current page | Duplex print sheet counts and printing cost |
When the Tool Reports an Error
Several input conditions cause the counter to display an error message rather than a page count. An empty file, a non-PDF selection, a file larger than 25 MiB, an encrypted or password-protected document, a file with damaged cross-reference data, or any PDF the underlying library cannot parse will all produce a visible error.
Password protection is not bypassed. If the document is encrypted, the counter will not guess or remove the password; the file must be unlocked with the correct password using a dedicated tool before it can be counted. Damaged cross-reference data usually means the trailer that points back into the page tree is inconsistent, and the counter surfaces that as an error rather than guessing at a total.
| Condition | Outcome |
|---|---|
| Empty file or non-PDF selection | Visible error, no count displayed |
| PDF larger than 25 MiB | Visible error, no count displayed |
| Encrypted or password-protected PDF | Visible error, password not bypassed |
| Damaged cross-reference data | Visible error, no count displayed |
| Unsupported PDF structure | Visible error, no count displayed |
What the Counter Does Not Do
The counter is strictly read-only, and the source PDF is not changed in any way. It does not add metadata, repair a damaged file, save a new copy, extract text, render thumbnails, count annotations, detect blank pages, count physical duplex sheets, or infer printing cost. No download is produced because the source is not modified, and the result exists only until another file is chosen or the tab closes.
If the task goes beyond inspection — for example, splitting the file at a known count, deleting a small number of pages, reordering pages, or resizing the geometry to a single paper standard — the counter is the wrong tool. It answers the structural count and the page-box inventory and stops there, leaving any modification to a dedicated PDF tool.
Related reading: PDF Page Counter for Beginners: A Plain-English Guide.
Related reading: PDF Page Counter for Printing Jobs.