Do Browsers Really Use Linked Lists for History? I Dug In to Find Out

We’ve all heard the classic explanation: browser history is like a doubly linked list. But is that what browsers actually use? Here's what a little curiosity uncovered.
@shadcn

Sushil sagar

12 days ago

do-browsers-really-use-linked-lists-for-history-i-dug-in-to-find-out

Rethinking the Textbook Tale

While revisiting linked lists, I decided not to just accept the standard examples at face value. One idea in particular made me pause:

“Browser history works like a doubly linked list — you can go backward and forward through visited pages.”

It’s a common teaching example. At first glance, it seems to fit. Each page connects to a previous and next one, and navigation mimics pointer traversal. But I wanted to know: is this actually how modern browsers implement history?

What Browsers Really Do

Spoiler: most browsers don’t use linked lists.

Instead, they typically rely on:

  • Arrays

  • Custom structures

  • An index pointer to track the current position

Here’s a simplified version of how it works:

  • Each new page is added to the end of the array.

  • If you go back and then visit a new page, all “forward” history is removed.

  • A pointer keeps track of your current spot.

This model is highly efficient thanks to arrays being:

  • Memory-local and cache-friendly

  • Easy to index (constant-time access)

  • Simpler to manage when insertions/deletions are minimal

So even if it behaves like a linked list to the user, under the hood, arrays dominate.

Why Not Use Linked Lists?

It boils down to practical trade-offs:

  • Linked lists shine when insertions/deletions happen anywhere in the sequence.

  • But browser navigation is mostly linear — either forward or back — with rare mid-history edits.

  • Arrays are better suited for that kind of usage pattern: fast, simple, and less memory overhead.

Where Linked Lists Actually Shine

Don’t get it wrong — linked lists are still incredibly useful, just in the right contexts:

Image Viewers
Navigate next/previous smoothly, with flexibility to add or remove slides.

Dynamic Music Playlists
Easily insert songs mid-play, reorder tracks, or jump around the queue.

Operating System Memory Management
Track fragmented memory chunks using free lists. Splitting, merging, and coalescing blocks is far easier with a linked list.

LRU Caches
Combine a doubly linked list with a hashmap for constant-time access and eviction — a classic pattern used in memory and browser caches (ironically!).

TL;DR

Textbooks may tell you browser history uses linked lists — and conceptually, it kind of does.

But in real-world implementations, arrays + pointers win out due to simplicity and performance.

So next time you hear that classic example, feel free to smile and say:

“It’s a good analogy. But not how it works in practice.”

Sometimes, asking small questions leads to big insights. Curiosity wins. ✅