Favorites

DOM Storage.removeItem() Method

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
Storage.removeItem()
DOM Storage MethodThis method is supported by all modern browsers.
Updated 28th November 2026

The removeItem() method deletes a key and its value from localStorage or sessionStorage. clear() deletes everything.

Description

The removeItem() method deletes a key and its value from the storage. Removing a key that doesn't exist does nothing. clear() removes every key for the origin, so use it carefully on a shared domain.

Removing a key that doesn't exist does nothing and doesn't fire a storage event. When clearing data on logout, remove the keys your application uses rather than calling clear(), in case other scripts on the same origin store data too.

Storage access can throw, for example in some private browsing modes or in sandboxed iframes, so wrap calls in try...catch where it matters. Both localStorage and sessionStorage support the method, and changes made in one tab fire a storage event in other tabs on the same origin.

Syntax

storage.removeItem(keyName)
storage.clear()

Parameters

  • keyNameThe key to remove.

Return Value

None (undefined).

Example

try {
  localStorage.setItem('temp', 'x');
  localStorage.removeItem('temp');
  console.log(localStorage.getItem('temp'));
} catch (e) {
  console.log('Storage unavailable:', e.name);
}

Browser Support

The following information will show you the current browser support for the Storage.removeItem() method. Hover over a browser icon to see the version that first introduced support for this method.

This method is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee