What is IndexedDB — a database in your browser with 60% of your disk

Here's a number that surprises people. localStorage gives you 5 megabytes. One photo from your phone won't fit.
IndexedDB, in the same browser, for the same site, gives you up to 60% of your disk. On a one-terabyte laptop that's six hundred gigabytes. Two storage systems inside one tab, roughly a hundred thousand times apart.
What IndexedDB is, in plain words
IndexedDB is a database inside the browser, on the user's device. The server knows nothing about it and never receives anything from it.
Three differences from the familiar localStorage:
- It stores objects, not strings. Arrays, nested structures, dates, whole files and images — no stringifying required.
- It has indexes. Hence the name: you can ask for "every record dated after yesterday" without scanning everything.
- It's asynchronous.
localStorageblocks the page while it works; IndexedDB doesn't. At any real size that's the difference between a responsive UI and a frozen tab.
The price is a clunky old API full of requests, events and transactions. Which is why nearly everyone reaches for a wrapper (idb, Dexie) and writes three lines instead of thirty.
5 megabytes versus 60 percent of the disk
The limits work in two tiers. There's Web Storage — localStorage and sessionStorage — with a hard ceiling: 5 MiB per origin each, 10 MiB total, in every browser. Go over and you get a QuotaExceededError.
Then there's the second group: IndexedDB, the Cache API and the origin private file system. They share one quota manager, and the numbers are wildly different:
- Chrome, Edge and other Chromium browsers — up to 60% of disk size per origin. A 1 TiB disk means a ceiling near 600 GiB.
- Firefox — the smaller of two: 10% of the disk, or the 10 GiB group limit. If a site asks for persistent storage, up to 50% of the disk, capped at 8 TiB.
- Safari (from macOS 14 and iOS 17) — also around 60% of disk for the browser itself. But if your site is open inside another app's embedded web view, the limit drops to about 15%.
One detail breaks everyone's intuition: the quota is calculated from the total disk size, not the free space. That's an anti-fingerprinting measure, so a site can't identify you by how full your drive is. Practical consequence: the browser may promise you 600 gigabytes on a disk with two free. A promise isn't a guarantee.
When the browser deletes all of it
Now the unpleasant part, the one people forget. By default your data is stored best-effort — "we'll try to keep it". Three ways it goes away:
- The device runs out of space. The browser deletes data from the least recently used origin, then the next one, until the pressure is gone.
- Safari and tracking prevention. If the user hasn't clicked or tapped on your site within the last seven days of browser use, everything scripts wrote is deleted. Cookies set by the server are exempt.
- Private browsing. Different quotas apply, and the data is usually wiped when the window closes.
And crucially: everything goes at once, not piecemeal. If you kept some things in IndexedDB and some in the Cache API, both disappear. Half-deleted storage is worse than empty storage, so browsers don't do it.
Want stronger guarantees? Ask for persistent storage: navigator.storage.persist(). Firefox prompts the user; Chrome and Safari decide silently based on how much the person has interacted with your site. Persistent data is exempt from eviction — only the user can remove it through settings.
Some comfort from the Chrome team: their research shows browsers evict data very rarely. If someone visits regularly, the odds of losing even best-effort data are close to zero. But "close to" is doing real work in that sentence — the only copy of anything important should not live in a browser.
How to check your own quota right now
Open the console on any site and run:
const q = await navigator.storage.estimate();
console.log(q.quota, q.usage); // ceiling and current usage, in bytes
The first number is what the browser is willing to give this origin; the second is what IndexedDB, the Cache API and their neighbours already use. You'll likely see tens of gigabytes and raise an eyebrow.
To check persistence: await navigator.storage.persisted(). To request it: await navigator.storage.persist().
Why bother, when there's a server?
Because heavy things moved into the browser over the last couple of years. Model weights for running AI inside a tab run to hundreds of megabytes, and no page gets to re-download that on every visit. They go into browser storage once.
Offline editors, mail clients, note apps — all of them keep data locally and sync when there's a network. Even ordinary caching of images and API responses lives inside this same quota.
Is IndexedDB a SQL database?
No. It's a key-value object store with indexes and no query language. Familiar SELECT and JOIN don't apply: you fetch objects by key or by an index range, then filter in code.
When should I use localStorage instead?
Settings, theme, an "I agree" flag — localStorage, because those are short strings and there are few of them. Anything past a couple of megabytes, anything holding files, anything you need to search — IndexedDB. There's no middle ground: 5 megabytes runs out abruptly.
Can the user delete this data?
Yes, at any time — "clear site data" in browser settings wipes everything, persistent storage included. So the browser works as a cache, a copy and an offline layer, but never as the only home for data that matters.
The AI Architect 2027 course: step by step from computer basics to your own app and first customers. 543 short lessons on your phone.





