Choose the right storage area
| Storage area | Use when | Notes |
|---|---|---|
storage.local | durable extension state on one device | best default for most extension data |
storage.sync | small user preferences across signed-in browsers | quota-sensitive and slower than local |
storage.session | short-lived session state | useful for ephemeral runtime coordination |
storage.managed | enterprise-managed policy values | schema-driven, read-only to the extension |
Recommended defaults
- Use
storage.localfor feature state, caches, and durable settings. - Use
storage.synconly for small, user-meaningful preferences. - Use
storage.sessionfor state that should not survive a full browser restart. - Treat
storage.managedas a separate enterprise path, not your general settings mechanism.
Service-worker-friendly patterns
Manifest V3 (MV3) background service workers can stop and restart between events, so do not rely on in-memory state alone.- Restore critical state from storage on demand.
- Cache in memory only as an optimization.
- Keep startup work small so event handling stays responsive.
- Persist versioned settings changes rather than assuming the background script stays running indefinitely.
Example settings module
Storage design checklist
- Decide which values must survive browser restarts.
- Decide which values should sync across devices, if any.
- Version your stored data shape before the first release.
- Keep a migration path for renamed keys or changed structures.
- Avoid storing secrets in client-readable extension storage unless you fully accept that any extension code can read them.
Managed storage
If you usestorage.managed, pair your runtime code with a valid storage.managed_schema file in manifest.json. Extension.js validates and emits that schema file to the output path.
For the JSON resource details, see JSON.
Common mistakes
- Using
storage.syncfor large data sets or caches. - Assuming background in-memory variables are durable in MV3.
- Storing multiple disconnected keys without a versioning strategy.
- Mixing enterprise-managed storage with user-editable settings without separating their access patterns.
Next steps
- Declare schema-backed enterprise storage in manifest.json.
- Review resource handling in JSON.
- Move state between contexts with Messaging.

