Extension Storage Areas, Quota Limits, and Web Platform Storage
How browser extensions persist data with the Storage API, choose local, sync, session, or managed areas, handle quotas, incognito, and web storage.
This page centres on Chrome extension storage (chrome.storage / browser.storage): the recommended way to save extension settings and state across service workers, popups, and content scripts. It also summarises how the HTML Web Storage API (localStorage / sessionStorage) and site-wide quota APIs relate to extensions, so you can pick the right mechanism and avoid common quota and privacy pitfalls.
chrome.storage API: what it stores and who can use it
Section titled “chrome.storage API: what it stores and who can use it”The Storage API is an extension-specific layer for user data and state. Chrome describes it as similar to web platform storage (IndexedDB and the Storage interface), but shaped for extension needs:
Use the chrome.storage API to store, retrieve, and track changes to user data.
— Chrome, browser.storage
The Storage API provides an extension-specific way to persist user data and state. It’s similar to the web platform’s storage APIs (IndexedDB, and Storage), but was designed to meet the storage needs of extensions. The following are a few key features:
All extension contexts, including the extension service worker and content scripts have access to the Storage API. The JSON serializable values are stored as object properties. The Storage API is asynchronous with bulk read and write operations. Even if the user clears the cache and browsing history, the data persists. Stored settings persist even when using split incognito. Includes an exclusive read-only managed storage area for enterprise policies.
— Chrome, browser.storage
Declare the storage permission in manifest.json when you use this API (not when you only use localStorage or IndexedDB on extension pages—see troubleshooting storage permission). Values must be JSON-serializable; objects and functions serialize according to the rules in StorageArea.
When is the storage permission required?
Section titled “When is the storage permission required?”| Situation | storage permission |
|---|---|
chrome.storage.* / browser.storage.* |
Required |
document.localStorage, sessionStorage, IndexedDB only |
Not required for the extension storage permission (per Web Store troubleshooting) |
Storage areas: local, sync, session, and managed
Section titled “Storage areas: local, sync, session, and managed”The API splits data into storage areas. Pick the area by lifetime, sync needs, sensitivity, and size—not by convenience alone.
| Area | Persistence | Typical use | Default quota (Chrome) |
|---|---|---|---|
storage.local |
Until extension removed; survives cache/history clear | Larger blobs, machine-specific state | ~10 MB (QUOTA_BYTES 10485760); unlimitedStorage overrides cap |
storage.sync |
Synced across signed-in Chrome profiles when sync is on; offline behaves like local | Small user settings | ~100 KB total, 8 KB per item, 512 items; write rate limits |
storage.session |
In memory while extension loaded; cleared on disable, reload, update, browser restart | Sensitive or ephemeral service worker state | ~10 MB (session QUOTA_BYTES 10485760) |
storage.managed |
Enterprise policies; read-only for the extension | Admin-preconfigured options | Policy-defined schema |
Data is stored locally and cleared when the extension is removed. The storage limit is 10 MB (5 MB in Chrome 113 and earlier), but can be increased by requesting the “unlimitedStorage” permission. We recommend using storage.local to store larger amounts of data.
— Chrome, browser.storage
If the user enables syncing, the data syncs with every Chrome browser that the user is logged into. If disabled, it behaves like storage.local. […] The quota limitation is approximately 100 KB, 8 KB per item.
— Chrome, browser.storage
Session storage holds data in memory while an extension is loaded. The storage is cleared if the extension is disabled, reloaded, updated, and when the browser restarts.
— Chrome, browser.storage
For sync, Chrome documents hard limits such as MAX_WRITE_OPERATIONS_PER_MINUTE (120) and MAX_WRITE_OPERATIONS_PER_HOUR (1800) on the same reference page—batch writes instead of hammering set() on every keystroke.
storage.managed and enterprise policy schema
Section titled “storage.managed and enterprise policy schema”Unlike local and sync, managed storage requires a JSON Schema in a file referenced by storage.managed_schema. Policies are read-only for the extension; invalid schema prevents the extension from loading. Verify loaded policies at chrome://policy as described in Manifest for managed storage.
Which storage area should I use?
Section titled “Which storage area should I use?”- Cross-device settings, small payload →
storage.sync(e.g. options pages in Chrome’s onChanged example). - Larger local-only data →
storage.local; request"unlimitedStorage"only when you genuinely need disk-scale data (Managing HTML5 Offline Storage describes unlimited storage for extensions). - Service worker scratch state or secrets for one browser session →
storage.session(service worker tutorial). - IT-managed defaults →
storage.managed.
Content script visibility defaults differ per area; use setAccessLevel() on each area when you need to restrict content script access (browser.storage).
Web Storage API vs extension storage in extensions
Section titled “Web Storage API vs extension storage in extensions”Developers often ask whether window.localStorage is “good enough” for an extension. Chrome does not recommend it for most extension logic:
While extensions can use the Storage interface (accessible from window.localStorage) in some contexts (popup and other HTML pages), we don’t recommend it for the following reasons:
Extension service workers can’t use the Web Storage API. Content scripts share storage with the host page. Data saved using the Web Storage API is lost when the user clears their browsing history.
— Chrome, browser.storage
The HTML spec adds a shared-host risk for localStorage: all paths on one host share one store, with no pathname isolation—relevant if an extension page is ever served from a shared host (unusual for chrome-extension://, but central to how the web platform works):
Different authors sharing one host name, for example users hosting content on the now defunct geocities.com, all share one local storage object. There is no feature to restrict the access by pathname. Authors on shared hosts are therefore urged to avoid using these features, as it would be trivial for other authors to read the data and overwrite it.
— WHATWG, Web storage — Edition for Web Developers
User agents should treat persisted web storage as potentially sensitive (WHATWG storage sensitivity).
Service workers and localStorage migration
Section titled “Service workers and localStorage migration”Extension service workers cannot touch localStorage or sessionStorage (Storage and cookies, Persist data rather than using global variables). Pattern: persist with browser.storage.local, or migrate via an offscreen document that reads localStorage once and writes into chrome.storage.
await browser.storage.local.set({ key: value });const result = await browser.storage.local.get(["key"]);For MV3, preload storage before handling events (asynchronous preload example) because service workers are ephemeral (lifecycle).
Quota, eviction, and navigator.storage on the web
Section titled “Quota, eviction, and navigator.storage on the web”Extensions still share the origin storage pool for IndexedDB, Cache Storage, and other APIs on extension pages. Storage and cookies notes:
- Extension-origin data is not removed when the user clears browsing data (including web storage used in the extension origin).
- Default quotas apply; call
navigator.storage.estimate()to inspect usage. "unlimitedStorage"affects both extension and web storage APIs on the extension origin and can exempt from quota and eviction.navigator.storage.persist()can request protection against eviction under pressure.
For ordinary websites (and PWA caching), Understanding storage quota explains per-browser dynamic limits via navigator.storage.estimate(). Chrome Incognito web apps get a special ~100 MB cap (Understanding storage quota).
Opaque cross-origin cache entries count heavily toward quota—about 7 MB minimum per opaque response in Chrome (Caching resources during runtime, Debug Progressive Web Apps). That matters when an extension page caches third-party assets.
On the open web, Storage Buckets and navigator.storage.persist() let sites prioritise what survives pressure; extension authors mirroring that pattern for large on-origin caches can combine buckets with persist() as in Cache models.
Use getBytesInUse() on a StorageArea when debugging quota (browser.storage).
Incognito mode, partitioning, and privacy
Section titled “Incognito mode, partitioning, and privacy”By default extensions do not run in incognito until the user enables access on the extension details page (Declare permissions). Test with extension.isAllowedIncognitoAccess().
When saving data, respect incognito’s “leave no tracks” promise (Protect user privacy):
Incognito mode promises that the window will leave no tracks. When dealing with data from incognito windows, extensions should honor this promise. If an extension normally saves browsing history, don’t save history from incognito windows. However, extensions can store setting preferences from any window, incognito or not.
— Chrome, Protect user privacy
Use tab.incognito or windows.Window.incognito before persisting browsing-derived data. chrome.storage.sync and chrome.storage.local remain shared between regular and incognito processes when using spanning mode; the Manifest incognito doc recommends them for extension settings. Detect script context with inIncognitoContext (browser.extension).
Manifest incognito: "spanning" (default, single shared process with flags), "split" (separate incognito process), or "not_allowed". Choose split if the extension must load extension pages in incognito tabs; choose spanning if it must share login state with a remote server (Manifest incognito).
From Chrome 115, storage partitioning can isolate embedded third-party storage; extensions get exemptions when chrome-extension:// pages embed or are embedded with host permissions (Storage and cookies).
Track changes with storage.onChanged
Section titled “Track changes with storage.onChanged”To react when any area updates, listen on chrome.storage.onChanged (browser.storage) or per-area StorageArea.onChanged (StorageArea). Options pages typically write storage.sync and service workers apply changes immediately—see the debug-mode sample in browser.storage.
Common mistakes
Section titled “Common mistakes”- Using
localStoragein a service worker (unsupported)—usebrowser.storageor IndexedDB/Cache from the worker (service worker lifecycle). - Assuming content script
localStorageis extension-private—it is the host page’s store (Storage and cookies). - Storing large or frequent writes in
storage.sync(100 KB cap and throttling). - Treating sync/local as a secure vault for passwords or health data (not encrypted).
- Forgetting that clear browsing data wipes web storage but not
chrome.storage(Storage and cookies). - Caching many opaque responses without accounting for inflated quota.
- Relying on global variables in MV3 service workers instead of storage (Migrate to a service worker).
Related APIs you might confuse with chrome.storage
Section titled “Related APIs you might confuse with chrome.storage”| API | Purpose |
|---|---|
chrome.system.storage |
Removable disk devices attached to the OS—not extension user data (system.storage) |
chrome.syncFileSystem |
Legacy Drive-backed sync; deprecated after 2025 (syncFileSystem) |
Web localStorage |
5 MB typical limit for extensions using it per FAQ; synchronous; cleared with browsing history |
Inspect and edit chrome.storage values in DevTools when the extension has the storage permission—see View and edit extension storage. Simulate site quotas in the Application panel (Improving the service worker development experience).
How to check this on your site
Section titled “How to check this on your site”- Open your extension’s service worker or popup, then DevTools → Application → Storage to review quota and optionally set a custom quota for testing (Improving the service worker development experience).
- With the
storagepermission enabled, use View and edit extension storage on achrome-extension://document or service worker to confirm keys inlocal,sync, andsession. - Call
navigator.storage.estimate()from an extension page if you also use IndexedDB or Cache Storage, and compare withchrome.storage.local.getBytesInUse()for extension API usage. - For managed extensions, open
chrome://policyand confirm policies match your managed schema. - You can check automatically in Answerwell (our tool): https://answerwell.org/workspace
Report an error or ask a question
Section titled “Report an error or ask a question”If something on this page is wrong or unclear, email yimasynthetic@gmail.com with the page URL and the exact statement you are asking about, and we will correct or clarify it.