Storage & Cookies · Privacy Tests

Local Storage Test

Test whether localStorage works, measure its real capacity and see what is already stored here.

Testing web storage…
—
—
KB capacity
—
Local keys
—
KB in use
Measured capacity against the usual 5 MB —

Availability

This origin right now

The capacity probe writes one large throwaway value under the key “__bs_ls_cap__”, measures how big it can get, then deletes it. The availability check writes and removes its own probe key in the same pass. Nothing is left in your browser and nothing is sent anywhere.

On this page
  1. What this test measures
  2. How big localStorage gets
  3. What is stored for this site
  4. When it is blocked
  5. Storage and tracking

What this localStorage test measures

This test does three things at once. It proves whether localStorage and sessionStorage actually work right now, it counts what is already held for this origin, and it measures how much the store will really accept before the browser refuses the write.

Availability is checked properly rather than assumed. The page writes a probe value under a known key, reads it back, compares the result, then removes it — all inside a try/catch, because a blocked store does not just return nothing, it throws on the very first write. Feature detection alone is not enough: browsers that block storage still expose the localStorage object, so a script that only checks for its existence is misled.

Availability is not the same as existence

A browser in a strict mode, or a page loaded inside a partitioned third-party frame, exposes the API and then throws a SecurityError the moment it is touched. The round trip above is what separates a working store from a denied one.

How big localStorage really is

Browsers give each origin a budget rather than a fixed size, and the widely quoted figure is about 5 MB per origin. That is a rough norm, not a specification, and it counts UTF-16 code units, so a value of English text costs roughly two bytes per character. Firefox has historically allowed a little more than Chromium, and some builds cap a single value as well as the origin total.

To find the real number, the test writes a throwaway value, doubling or halving it until it finds the largest size that survives, then removes it. That is a binary search over roughly ten million characters, and it converges in about fourteen writes. The figure is reported in KB and shown against the 5 MB norm above.

Two honest caveats. The measurement runs while other data is present, so it reflects the space left rather than a guaranteed allocation. And the estimate of current usage counts key and value characters only; it ignores the per-entry overhead the browser adds, so treat that number as a floor.

What is already stored for this site

localStorage is a plain key-value map, and the test reports how many keys this origin currently holds and roughly how much space they take. It deliberately does not print the keys or their contents: those values often belong to a login session or a preference, and there is no reason to put them on screen for a test that only needs to count them.

The count can be larger than you expect even on a first visit. Anything served from this domain shares the same store, so a theme preference, a dismissed banner, a cached draft or an analytics queue all appear. The number is also the useful part: if it stays at zero after a page claims to remember your settings, the write probably failed silently.

For a closer comparison of what each mechanism holds and when it expires, the cookies and storage test lines cookies, local storage, session storage and IndexedDB up against each other.

When localStorage is blocked

A blocked store is common and usually deliberate. Strict privacy settings, an extension that clears site data, an embedded third-party frame, or a browser profile configured to forget everything on close will all refuse the write. The result is a page that looks like it saved your work and then loses it on the next visit.

  • Third-party context. If this page is inside an iframe on another domain, storage is partitioned or denied outright.
  • Private windows. Modern Safari and Firefox allow storage in a private window but delete it when the window closes, so the write succeeds and the data still disappears.
  • Full quota. A store that is already at its limit throws the same QuotaExceededError as a store that is forbidden, which is why this test reports capacity separately from availability.

If a trusted site cannot remember you, allow cookies and site data for that domain in your browser settings rather than switching everything on.

Storage, tracking and what to do about it

An identifier in localStorage is one of the easier ones to remove: clear site data for the origin and it is gone. That weakness is exactly why trackers spread identifiers across several stores at once, so that wiping cookies leaves the copy in IndexedDB or CacheStorage untouched. The evercookie test maps those surfaces, and the IndexedDB test covers the larger store next to this one.

Worth keeping in proportion: blocking storage narrows one channel and does nothing about the other. A device fingerprint needs no storage at all, so it survives every wipe and re-identifies the same machine. If the goal is to be less trackable rather than to be tidy, the fingerprint test shows what is actually being measured.

What this page does not do

It cannot read another site’s storage, and it does not try. It writes one probe key and one capacity string, measures them, and deletes both before you see the result.

Frequently Asked Questions

What is localStorage in one sentence?
It is a small key-value store that a page can write to and read back later. The data stays in your browser until it is cleared, survives closing the tab and restarting the browser, and is never sent to a server automatically. See the cookies and storage test for how it compares with cookies.
How much can localStorage actually hold?
Most browsers allow roughly 5 MB per origin, and Firefox a little more. The test above binary-searches for the real figure by writing progressively larger values until one is refused, then deletes every one of them. A few browsers cap an individual value as well as the total, so a single huge string can fail before the store is full.
Why does the test show keys I did not create?
Any script on this origin can write here, so the count includes anything left by this site’s own features and by any other page served from the same domain. A site cannot read another site’s localStorage: the store is separated per origin, so a different domain sees a completely different, empty store.
Does sessionStorage work the same way?
It uses the identical API but a different lifetime. Session storage is scoped to one tab and is deleted when that tab closes, so it is used for half-finished forms and one-off state rather than anything that needs to last. Both are blocked or allowed together in practice, which is why the test checks them side by side.
Does clearing localStorage make me less trackable?
It removes stored identifiers, which is worth doing, but it does not change how identifiable your device is. A browser fingerprint stores nothing and re-identifies you anyway, so clearing storage narrows one channel rather than closing tracking down.