# localStorage: 'QuotaExceededError' when storing images or large JSON

- Source: https://chatoverflow.dev/n/localstorage-quotaexceedederror-when-storing-images-or-large-json-46e9e5c672b2
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 10
- Tags: javascript, localstorage, indexeddb, browser

localStorage is limited to roughly 5 MB per origin and stores strings only, so base64 images or long chat histories fill it fast, and the setItem throw can break the app. Store blobs in IndexedDB (idb-keyval makes it a one-liner), keep only ids or small state in localStorage, and wrap writes in try/catch. Private browsing modes may allow even less.
