3 min read
Learn why IndexedDB is the superior choice for handling large data like images in your web app, and how it beats the limitations of localStorage.
Posted byThức Trần

While working on a feature that caches image data for the user's last searches, I ran into a limitation: caps out at around 5MB (and only stores strings). Not ideal when you're dealing with images or structured data.localStorage
That’s when I turned to IndexedDB — the browser’s built-in, asynchronous, low-level NoSQL database.
IndexedDB is a client-side storage API that lets you store large amounts of structured data, including files like images and blobs. Unlike , it's:localStorage
In my app, users can search content that includes image previews. I wanted to:
Using worked at first — until I hit the size limit and got a localStorage. Not fun.QuotaExceededError
IndexedDB, on the other hand, gives me hundreds of MBs (depending on the browser) and lets me store image blobs alongside metadata in a structured way.
There’s no hard-fixed limit, but here’s what most modern browsers do:
StorageManager.persist()), browsers are more generous.
| Browser | Approx Quota (Typical Desktop) | Notes |
|---|---|---|
| Chrome/Edge | ~6% of available disk space | Can exceed 1GB if space allows |
| Firefox | 2GB–10GB (depending on platform) | Generous, especially on desktop |
| Safari | 50MB–1GB+ (but more conservative) | Often limits per-origin storage |
| Mobile Browsers | Lower (often 50–200MB) | Depends heavily on free space and usage patterns |
If your app uses too much, browsers may prompt the user or throw quota errors, especially on mobile.
In DevTools:
navigator.storage.estimate() to programmatically check:
navigator.storage.estimate().then(({ usage, quota }) => { console.log(`Using ${usage} of ${quota} bytes.`); });
Check IndexedDB storage capacity
Here’s how others typically use IndexedDB:
You can use IndexedDB directly via the native API, but it’s verbose. If you want a smoother DX, check out libraries like:
If you're hitting the ceiling with , or you need to cache binary data like images — IndexedDB is your best friend. It takes a little getting used to, but it's incredibly powerful for building fast, offline-capable experiences.localStorage
This blog is powered by my kind mate - ChatGPT!
Posted by