Developer & Tech

API Pagination Calculator

What this does

Compute page count, offset and item placement for paginated APIs; including honest handling of pages beyond the range.

Enter your details

Runs in your browser

Calculator inputs

Using the api pagination calculator

  1. 01

    Enter collection size and page size

    Whatever your API reports as total count and whatever limit you request.

  2. 02

    Enter the page you want

    The calculator gives the offset parameter and exactly how many items come back.

Offset pagination’s limits

Offset/limit paging is easy but fragile: inserts shift items across page boundaries, deep offsets force databases to scan skipped rows, and totals drift under concurrent writes. Cursor pagination solves these at the cost of losing random access.

Beyond-the-range requests

Well-behaved APIs return an empty list rather than a 404 for past-the-end pages. This calculator mirrors that behavior; zero items, flagged interpretation; so you can sanity-check clients that loop until an empty page appears.

The math behind this calculator

pages = ⌈total ÷ size⌉ offset = (page − 1) × size items = min(size, total − offset)

Total pages round the collection up to whole pages. The offset counts how many items earlier pages consume, and items-on-page caps at whatever remains. Requesting a page past the end still computes; it honestly returns zero items and flags the overflow instead of erroring.

Assumptions & limitations

  • 1-based page numbering (page 1 starts at offset 0).
  • Whole numbers only for totals, sizes and pages.
  • Cursor-based pagination follows different math entirely.

Worked example

With 1,000 items served 50 at a time, page 7 skips 300 items and returns the full 50, with 13 more pages after it.

Frequently asked questions

Is page numbering 0-based or 1-based here?
1-based, matching most human-facing APIs. Subtract one yourself if your API starts at zero.
What offset do I send for page 7 of 50-item pages?
(7 − 1) × 50 = 300; the rows panel shows this directly.
Why does page 999 return items instead of an error?
It returns zero items with a “page beyond range” interpretation; mirroring how tolerant APIs behave.

Related calculators