We're looking for a person or people to help audit MDN to find places we could speed up. Is this you or someone you know? Check out the RFP: https://mzl.la/2IHcMiE



Stores one or more items in the storage area, or update existing items.

When you store or update a value using this API, the storage.onChanged event will fire.

This is an asynchronous function that returns a Promise.


let settingItem = browser.storage.<storageType>.set(
  keys             // object

<storageType> will be one of the writable storage types — storage.sync or storage.local.



An object containing one or more key/value pairs to be stored in storage. If an item already exists, its value will be updated.

Values may be primitive types (such as numbers, booleans, and strings) or Array types.

It's generally not possible to store other types, such as Function, Date, RegExp, Set, Map, ArrayBuffer and so on. Some of these unsupported types will restore as an empty object, and some cause set() to throw an error. The exact behavior here is browser-specific.

Return value

A Promise that will be fulfilled with no arguments if the operation succeeded. If the operation failed, the promise will be rejected with an error message.

Browser compatibility

ChromeEdgeFirefoxFirefox for AndroidOpera
Basic support Yes Yes1454833

1. storage is limited to 1MB per value.


function setItem() {

function gotKitten(item) {
  console.log(`${item.kitten.name} has ${item.kitten.eyeCount} eyes`);

function gotMonster(item) {
  console.log(`${item.monster.name} has ${item.monster.eyeCount} eyes`);

function onError(error) {

// define 2 objects
var monster = {
  name: "Kraken",
  tentacles: true,
  eyeCount: 10

var kitten = {
  name: "Moggy",
  tentacles: false,
  eyeCount: 2

// store the objects
browser.storage.local.set({kitten, monster})
  .then(setItem, onError);

  .then(gotKitten, onError);
  .then(gotMonster, onError);


This API is based on Chromium's chrome.storage API. This documentation is derived from storage.json in the Chromium code.

Document Tags and Contributors

 Contributors to this page: wbamberg, Kwan, cmcaine, jonathanKingston, Makyen, chrisdavidmills
 Last updated by: wbamberg,