Join our Newsletter — 33% off our NHI Course

When is cursor-based pagination a better choice than page-number pagination for infinite scroll?

Cursor-based pagination is better when the list can change while users are paging through it. If records are inserted or deleted between requests, page numbers can shift and cause gaps or duplicates. A cursor asks for the item after a known record, which keeps the next batch stable even when the dataset changes mid-session.

Why cursor pagination fits unstable infinite-scroll feeds

Infinite scroll usually needs a stable “next batch” more than a fixed page number. Cursor-based pagination works best when the underlying list can change between requests, because the cursor points to a known record or position instead of a fragile page index. That makes it the safer choice for activity feeds, search results with fresh content, and any stream where new items can arrive while the user keeps scrolling.

Page-number pagination assumes the dataset is mostly static. If inserts or deletes happen while a user is midway through the list, the same page number can return different records on the next request. A cursor avoids that shifting boundary, so the UI can continue loading without skipping items or showing duplicates.

One practical way to think about it is that page numbers describe a snapshot, while cursors describe continuation. For an endless feed, continuation is usually the better model because users care about moving forward from what they already saw, not about jumping to a precise ordinal page.

Where cursor pagination changes the implementation trade-off

Cursor pagination gives you consistency, but it changes how the API is designed and how the client behaves. The server must encode a stable sort order and return a token that identifies the next position. The client then passes that token back instead of incrementing page numbers. This is usually a better fit for feeds sorted by timestamp, rank, or another field that can support deterministic continuation.

The trade-off is that cursors are less convenient for random access. They are excellent for “load more” flows, but they are not ideal when users need to jump directly to page 12, compare distant ranges, or share a stable page reference. If the product requirement is browse-forever, cursor pagination is usually the right default; if the requirement is direct navigation, page numbers remain useful.

Cursor design also depends on sort stability. If the sort key is not unique or can be reordered frequently, the cursor must include enough tie-breaking context to avoid ambiguity. That is why many implementations use a composite cursor, not just a raw item ID.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

NIST CSF 2.0 and CIS Controls v8 set the governance and control requirements practitioners need to meet.

Framework Control / Reference Relevance
NIST CSF 2.0 PR.AC-4 — Access Control and Authorization Stable continuation tokens reflect controlled access to the next result set.
Recommendation — Use PR.AC-4 to enforce predictable authorization for paged API access.
CIS Controls v8 6.3 — Access Management Pagination tokens and query boundaries are part of API access control design.
Recommendation — Apply access-management controls to limit unintended result-set exposure.

Practitioner Guidance

What to verify: Use cursor pagination when the feed is append-heavy, frequently updated, or likely to be filtered by a changing sort order. Verify that the backend sort is deterministic and that inserts or deletes will not cause the cursor to drift across batches.

Decision rule: If the user experience is “keep scrolling forward,” prefer cursors; if the experience is “go to an exact page,” page numbers are a better fit. When both are required, expose cursor pagination for the scroll path and keep numbered navigation for separate browse or archive views.

Common mistake: Teams often keep page numbers in the API while building infinite scroll on top of them. That works until the dataset changes mid-session, then the UI starts skipping or repeating items and the bug is hard to reproduce.

Practitioner takeaway: Cursor pagination is not just an optimization, it is a consistency choice. For infinite scroll, choose the model that preserves continuity under change, then make sure the sort order and cursor token are stable enough to support that promise.