Skip to main contentSkip to navigationSkip to searchSkip to footer

How to Count PDF Pages: Single Files, Batches and Scripts

Count pages in one PDF or a batch using a local browser tool, Python or command-line utilities. Includes file limits, failed-file handling and the difference between page counts and labels.

NextUtils Team
Updated October 4, 2026
12 min read
Maintainers of NextUtils document tools

Quick answer

Choose one PDF or a batch in the browser counter. Read each count and the combined total, then export a CSV. Files are processed on your device without opening a PDF reader.

Open PDF Page Counter

Up to 50 files, 50 MB each. Unreadable files are excluded from the total. The methods below explain scripts, file properties and troubleshooting.

Count a batch and export the results

  1. Open the PDF Page Counter and choose multiple PDFs, or drop them into the selection area.
  2. Check the count beside each filename. A batch containing 12, 8 and 20 pages gives a total of 40 pages.
  3. Choose Export CSV to save filenames, page counts and statuses. Failed files are listed separately and excluded from the total.

Select up to 50 files, with a 50 MB limit per file. Files are processed one at a time in your browser. Cancel stops the queue while preserving completed counts. Password-protected files need an unlocked copy; damaged files may need repair. Large or complex PDFs can exceed your browser resources.

The total measures physical PDF pages, not printed page labels. A scanned PDF still contains pages even when its text cannot be selected. Document contents are not uploaded; website analytics and advertising are described in the privacy policy.

Whether you're managing documents for a business, preparing files for printing, or organizing a large document library, knowing how to quickly count PDF pages without opening each file is an essential skill. This guide covers 5 proven methods to check PDF page counts efficiently, saving you time and frustration.

Why Knowing PDF Page Count Matters

Printing & Cost Estimation

Print shops need accurate page counts for quotes. Knowing your document's page count helps estimate printing costs, paper requirements, and delivery times before sending files to press.

Document Management

Organizing large document libraries requires quick metadata extraction. Page counts help categorize, sort, and manage thousands of PDFs without manual inspection.

Compliance & Limits

Many platforms have document page limits (e.g., email attachments, submission portals, court filings). Verify page counts before uploading to avoid rejections and delays.

Bulk Processing

When processing hundreds of PDFs, opening each file is impractical. Automated page counting enables efficient batch operations, reporting, and quality control.

Method 1: Online PDF Page Counter Tools (Fastest & Easiest)

A browser counter is a convenient way to check page counts without installing software. Processing time depends on the document and your device.

✨ Try Our Free PDF Page Counter

Count pages from single or multiple PDF files instantly. No registration required, 100% free, and works locally in your browser. Document contents are not uploaded; website analytics and advertising are separate.

How It Works:

  1. Select your PDF files; the counter reads them locally in your browser
  2. The tool parses the PDF document structure to obtain its page count
  3. Read the result when processing finishes
  4. For multiple files, see a detailed breakdown with total sum

Best For:

  • Quick one-off checks
  • Users without technical knowledge
  • Mobile devices and tablets
  • Processing multiple PDFs at once
  • Privacy-conscious users (client-side processing)

Method 2: Using File Properties (Windows & Mac)

File properties can expose a page count, but the available fields depend on your system's PDF property handler and indexed metadata. A missing Pages field does not mean the PDF has no pages.

Windows:

  1. Right-click the PDF file in File Explorer
  2. Select "Properties" from the context menu
  3. Click the "Details" tab
  4. If a "Pages" field is present, read its value
  5. If it is missing, use a PDF reader or the browser counter instead

macOS:

  1. Select the PDF file in Finder
  2. Press ⌘ + I or choose File → Get Info
  3. Expand the "More Info" section
  4. If a page-count field is available, read it; otherwise open the file in Preview

Limitations:

  • Windows needs a property handler that exposes PDF page counts
  • Installing a reader does not guarantee the Pages field will appear
  • macOS metadata may be absent or not yet indexed; Preview provides a direct viewing alternative
  • Only works for single files (not bulk)
  • Manual process for multiple documents
  • May not work for all PDF types or encrypted PDFs

Method 3: Command Line Solutions (Advanced)

For developers and power users, command-line tools provide automation capabilities and batch processing.

Using PDFInfo (Linux/Mac/Windows):

# Install pdfinfo (part of poppler-utils)
# Ubuntu/Debian:
sudo apt-get install poppler-utils

# macOS:
brew install poppler

# Get page count:
pdfinfo document.pdf | grep Pages

# Output: Pages:          42

Using Python (Cross-platform):

⚠️ Important Update:

PyPDF2 is deprecated since December 2022. Use pypdf instead for all new projects.

# Install pypdf (PyPDF2 is deprecated)
pip install pypdf

# Python script to count pages:
from pypdf import PdfReader

reader = PdfReader("document.pdf")
page_count = len(reader.pages)
print(f"Total pages: {page_count}")

# For multiple PDFs with error handling:
import glob
for pdf_file in glob.glob("*.pdf"):
    try:
        reader = PdfReader(pdf_file)
        print(f"{pdf_file}: {len(reader.pages)} pages")
    except Exception as e:
        print(f"{pdf_file}: ERROR - {e}")

Using PowerShell (Windows):

# Requires Python and pypdf; no Acrobat COM integration needed
python -m pip install pypdf
python -c "from pypdf import PdfReader; print(len(PdfReader('document.pdf').pages))"

Best For:

  • Automating bulk PDF analysis
  • Server-side document processing
  • Generating reports from large PDF libraries
  • CI/CD pipelines and workflows
  • Developers comfortable with scripting

Alternative Command-Line Tools

Beyond pdfinfo and Python, several other powerful command-line tools can count PDF pages quickly.

Using QPDF (Fast & Lightweight):

# Install QPDF
# Ubuntu/Debian:
sudo apt-get install qpdf

# macOS:
brew install qpdf

# Windows (Chocolatey):
choco install qpdf

# Get the physical page count:
qpdf --show-npages document.pdf

# Output: 42

These commands are alternatives, not speed benchmarks. Runtime depends on the document, storage, software version and available memory. Spotlight metadata returned by mdls can be missing or stale; use a PDF parser when you need a fresh count from the file itself.

Using ExifTool (Universal Metadata):

# Install ExifTool
# Ubuntu/Debian:
sudo apt-get install libimage-exiftool-perl

# macOS:
brew install exiftool

# Windows: Download from https://exiftool.org

# Get page count:
exiftool -PageCount document.pdf

# Output: Page Count: 42

# For multiple files with CSV export:
exiftool -csv -PageCount *.pdf > page_counts.csv

Using mdls (macOS Native):

# No installation needed on macOS (built-in)
mdls -name kMDItemNumberOfPages document.pdf

# Output: kMDItemNumberOfPages = 42

# For multiple files:
for pdf in *.pdf; do
    echo -n "$pdf: "
    mdls -name kMDItemNumberOfPages "$pdf" | awk '{print $3}'
done

Tool Comparison:

ToolCount sourcePlatformBest Use
qpdfPDF structureAllCommand-line inspection
pdfinfoPDF structureUnix/Mac/WinGeneral purpose
exiftoolPDF metadataAllMetadata extraction
mdlsIndexed metadatamacOS onlyNative macOS solution
pypdfPDF structureAll (Python)Custom automation

Method 4: PDF Reader Software

Popular PDF readers show page counts in their interfaces, though they require opening the file.

Adobe Acrobat Reader (Free)

Page count appears in the bottom status bar: "Page X of Y"

✓ Most compatible • ✓ Industry standard • ✗ Requires installation

Preview (macOS Built-in)

Shows total pages in sidebar and toolbar

✓ Pre-installed on Mac • ✓ Fast • ✗ macOS only

Foxit Reader (Free)

Displays page count in status bar and file properties

✓ Lighter than Adobe • ✓ Fast loading • ✗ Requires installation

Note:

While these methods work, they defeat the purpose of counting pages "without opening files" since the PDF must be rendered. Use online tools or command-line solutions for true unopened counting.

Method 5: Bulk PDF Page Counter for Multiple Files

When managing hundreds or thousands of PDFs, manual checking is impossible. Here are the best bulk solutions:

Online Bulk Counters:

  • NextUtils PDF Page Counter: Select multiple PDFs, review individual counts and the total - Try now
  • Select up to 50 files, each no larger than 50 MB; processing is sequential
  • See individual and cumulative page counts
  • Export results as CSV for reporting

Scripted Solutions:

# Save as count_pages.py; run with: python count_pages.py
# Install the dependency first: python -m pip install pypdf
import csv
from pathlib import Path
from pypdf import PdfReader

files = sorted(path for path in Path('.').iterdir()
               if path.is_file() and path.suffix.lower() == '.pdf')
total = counted = failed = 0
with open('page_counts.csv', 'w', newline='', encoding='utf-8-sig') as report:
    writer = csv.writer(report)
    writer.writerow(['filename', 'pages', 'status'])
    for path in files:
        try:
            with path.open('rb') as source:
                pages = len(PdfReader(source).pages)
            writer.writerow([path.name, pages, 'counted'])
            total += pages
            counted += 1
        except Exception:
            writer.writerow([path.name, '', 'unreadable'])
            failed += 1
print(f'{counted} counted, {failed} unreadable, {len(files)} selected')
print(f'Total pages in counted files: {total}')

This example reads PDFs in the current directory, including .PDF extensions, and overwrites page_counts.csv there. It does not recurse into subfolders. CSV quoting preserves commas in filenames; an unreadable file has a blank page count and is excluded from the total. It may need a password, repair or a different parser. Inspect filenames as text when opening a report in a spreadsheet.

Pro Tip:

For recurring bulk analysis, combine command-line tools with task schedulers (cron, Task Scheduler) to generate automated reports on document libraries.

When You Need to Know PDF Page Count

Professional & Business:

  • Legal Filings: Court documents have strict page limits
  • Publishing: Verify manuscript page counts before printing
  • Billing: Charge clients based on document pages processed
  • Email Limits: Check if attachments meet size/page restrictions

Academic & Education:

  • Thesis Submissions: Universities often have maximum page requirements
  • Assignment Compliance: Verify student work meets page guidelines
  • Library Management: Catalog digital resources by length
  • Reading Assignments: Estimate time needed for materials

Best Practices & Tips

Choose the Right Method

Single files: Use online tools for convenience. Bulk processing: Use command-line scripts. Automation: Integrate API solutions.

Verify Accuracy

Always cross-check critical documents. Some PDFs with non-standard formatting may report incorrect page counts. Open the file manually if precision is essential.

Consider Privacy

For confidential documents, use client-side online tools (like NextUtils) or local command-line solutions. Avoid cloud-based services that upload files to remote servers.

Automate Repetitive Tasks

If you regularly check page counts for large document sets, create a script or workflow. Save time with scheduled batch processing instead of manual checks.

Handling Edge Cases & Troubleshooting

Real-world PDF processing involves dealing with encrypted files, corrupted documents, and various edge cases.

Encrypted/Password-Protected PDFs

Most tools will fail on encrypted PDFs with errors like "PdfReadError" or "Permission denied." Here's how to handle them:

from pypdf import PdfReader

try:
    reader = PdfReader("encrypted.pdf")
    if reader.is_encrypted:
        # Try empty password first (some PDFs are "encrypted" with no password)
        if reader.decrypt(''):
            print(f"Pages: {len(reader.pages)}")
        else:
            # Prompt for password
            password = input("Enter PDF password: ")
            if reader.decrypt(password):
                print(f"Pages: {len(reader.pages)}")
            else:
                print("ERROR: Incorrect password")
    else:
        print(f"Pages: {len(reader.pages)}")
except Exception as e:
    print(f"ERROR: {e}")

Corrupted PDF Files

The batch script above catches a failure for each file, records an unreadable status and continues. An error is not a zero-page document, and does not by itself prove corruption: an inaccessible or password-protected file can fail too.

Scanned PDFs vs. Text PDFs

✓ Good news: Page counting works for both text-based and scanned (image-based) PDFs. These tools read PDF structure metadata, not content. However, severely corrupted or non-standard PDFs may fail. For scanned PDFs, the page count remains accurate even though text extraction would require OCR.

Common Errors & Solutions

Error: "Command not found: pdfinfo"

Solution: Install poppler-utils: sudo apt-get install poppler-utils (Linux) or brew install poppler (macOS)

Error: "PdfReadError: EOF marker not found"

Solution: PDF file is corrupted. Try:

  1. Open in Adobe Reader and re-save
  2. Inspect the structure with qpdf --check document.pdf. This command does not save a repaired copy.
  3. If qpdf can recover the input, write a separate copy with qpdf document.pdf recovered.pdf, then inspect the result. Recovery is not guaranteed.
  4. If repair fails, file may be unrecoverable

Script hangs on large PDF (1000+ pages)

Solution: Try a command-line parser such as qpdf or pdfinfo and measure your actual documents. Add a timeout and a progress indicator; page count alone does not predict processing time.

Frequently Asked Questions

Can I count PDF pages without Adobe Acrobat?

Yes, absolutely! Online tools (like NextUtils PDF Page Counter), command-line utilities (pdfinfo, qpdf, exiftool), and programming libraries (pypdf, pdf-lib) all work without Adobe software. Most methods don't require any paid software.

Does page counting work on encrypted/password-protected PDFs?

NextUtils does not ask for a password. If it reports that the document requires one, use an unlocked copy you are permitted to create. Libraries such as pypdf can decrypt supported files with the correct password; see the example in the troubleshooting section.

What's the fastest method for counting pages in 1000+ PDFs?

Command-line tools like qpdf or pdfinfo in a bash/PowerShell script. These support automation without opening a reader for every file. There is no universal fastest method or per-file runtime; benchmark representative documents and report failures separately. Use qpdf --show-npages document.pdf for a single-file count.

Are online PDF page counters safe for confidential documents?

Use client-side tools (like NextUtils PDF Page Counter) that process files entirely in your browser without uploading to servers. For highly sensitive documents (legal, medical), use local command-line tools. Always check the tool's privacy policy.

Why do some tools show different page counts for the same PDF?

First distinguish the physical page count from printed labels: covers and prefatory pages can change the apparent number. If two parsers disagree about the same physical pages, inspect the file structure and verify it in a reader. Recovery of a damaged file is not guaranteed.

How to count PDF pages programmatically in JavaScript/Node.js?

Use the pdf-lib or pdf-page-counter npm packages:

// Using pdf-lib
import { PDFDocument } from 'pdf-lib';
const pdfBytes = await fetch('document.pdf').then(res => res.arrayBuffer());
const pdfDoc = await PDFDocument.load(pdfBytes);
console.log(pdfDoc.getPageCount());

// Using pdf-page-counter (Node.js)
const pdf = require('pdf-page-counter');
const dataBuffer = fs.readFileSync('document.pdf');
pdf(dataBuffer).then(data => console.log(data.numpages));

Do page counting tools work on scanned PDFs?

Yes! Page counting works on both text-based and scanned (image-only) PDFs because it reads document structure, not content. Whether your PDF contains searchable text or scanned images, the page count will be accurate.

Is there a difference between page numbers and page count?

Yes! Page count is the total number of pages (e.g., 150 pages). Page numbersare the labels displayed in the document (which may use Roman numerals i, ii, iii for front matter, then 1, 2, 3). Page counting tools always return the total number of pages, regardless of numbering scheme.

Is there a completely free PDF reader?

Yes. Adobe Acrobat Reader (free version), Preview on macOS, Foxit Reader, and browser-based tools like Google Drive's PDF viewer are all completely free. For page counting specifically, browser-based PDF page counters are free, require no installation, and process files entirely in your browser.

How can I count pages without opening a PDF reader?

Select the file in a browser counter that processes it locally, or run pdfinfo filename.pdf in a terminal. Both read the PDF structure without displaying each page. File properties may also show a count, but only when the required handler or indexed metadata is available.

More PDF Tools You Might Need

Once you know your page count, these tools handle the next step.

Conclusion

Counting PDF pages without opening files is essential for efficient document management, whether you're handling printing quotes, verifying submission requirements, or organizing large libraries. The best method depends on your needs:

  • Quick checks: Use online PDF page counter tools
  • Single files: Check file properties (Windows/Mac)
  • Bulk processing: Use command-line tools (pdfinfo, Python)
  • Automation: Script solutions with cron jobs or schedulers

Ready to Count PDF Pages Instantly?

Select one PDF or a batch in the free browser counter. Document contents stay on your device; website analytics and advertising are explained separately in the privacy policy.

Use PDF Page Counter Tool - Free →

Have questions or need help with PDF management? Explore our other document tools for splitting, merging, rotating, and more.

References and method limits

The examples count physical pages rather than printed labels. qpdf --check inspects a file; saving a recovered copy is a separate operation. No method guarantees recovery of a damaged PDF.

Try These Free Tools

Share this article

Related Articles

Continue exploring with these related posts

Ready to try our tools?

Explore our collection of free online tools for developers, designers, and power users.

Explore All Tools

Explore More Tools

Discover our collection of free online tools for developers, designers, and power users