Chrome extensions have access to three main types of storage mechanisms.
Each is suited to different use cases and has different permissions and limitations.
chrome.storage APIThe official Chrome extension storage API.
chrome.storage.local
chrome.storage.sync
chrome.storage.session (Manifest V3 only)
localStorage
Synchronous (sync):
localStorage)Asynchronous (async):
chrome.storage, IndexedDB)manifest.json
| Storage Type | Required Permission |
|---|---|
chrome.storage.* |
"storage" |
localStorage |
โ No special permission |
IndexedDB |
โ No special permission |
โ
chrome.storageneeds the"storage"permission in your manifest.
An origin is the combination of:
protocol + domain + porthttps://example.com is one originhttp://example.com is a different origin
In Chrome extensions:
chrome-extension://<extension-id>
localStorage and IndexedDB are scoped to your extensionโs origin
โ ๏ธ Extensions cannot access webpage storage unless explicitly allowed.
| Storage | Max Size | Sync? | Async? | Recommended Use |
|---|---|---|---|---|
chrome.storage.local |
~5MB+ | โ | โ | General storage |
chrome.storage.sync |
100KB | โ | โ | User preferences |
chrome.storage.session |
Session | โ | โ | Temporary runtime state |
localStorage |
5MB | โ | โ | Quick hacks or legacy fallback |
| IndexedDB | Large | โ | โ | Large/structured data |
chrome.storage.local for most simple needschrome.storage.sync for synced preferences/settingschrome.storage.session for transient stateslocalStorage unless you really know what you're doingChallenge:ย What is the difference between the behavior or chrome.storage vs IndexedDB for JSON data?
Try storing the valueย { "key": 1 }ย ...