112

Is it possible to clear HTML5 local storage on a specific web page? I was editing a Javascript demo on http://jsfiddle.net, and I re-arranged the windows in such a way that one of them became impossible to resize. Is it possible to clear local storage on a specific page in this case?

1
  • use the browser's console to change localStorage's contents. it is just a javascript object like any other.
    – user428517
    Dec 22, 2015 at 22:27

8 Answers 8

177

Chrome now provides an option to clear Local Storage of a specific site. For this, enter this in the Omnibox

chrome://settings/siteData

Now, you can type the site name, select Local storage and click on Remove to clear local storage for the site

enter image description here

4
  • 3
    If only it didn't crash every time I try to search / delete something there...
    – Selrond
    Jan 1, 2019 at 17:59
  • Haha yes, same here, I had to look for the item manually through the list @Selrond
    – ChesuCR
    Mar 27, 2019 at 18:00
  • Seemed to work OK for me...
    – rogerdpack
    Oct 13, 2020 at 5:13
  • Notably, this won't work on Android... Jul 12, 2021 at 4:16
63

While Chrome does not provide a UI for clearing localStorage, there is an API that will either clear a specific key or the entire localStorage object on a website.

//Clears the value of MyKey
window.localStorage.removeItem("MyKey");

//Clears all the local storage data
window.localStorage.clear();

Every Chrome browser, by default, has the JavaScript console installed. So an alternative method, and perhaps the easiest way, to clear localStorage is to right click on the page, click "Inspect Element", then click the "Console" tab. When the console opens, type the following JavaScript, and press enter:

window.localStorage.clear()

Once done, localStorage will be cleared. Note that this affects all web pages on a single domain, so if you clear localStorage for jsfiddle.net/index.html (assuming that's the page you're on), then it clears it for all other pages on that site. See HTML5Goodies - A Peek into Local Data Storage in HTML 5 for more information.

0
10

Chrome does not yet provide an interface to manage HTML5 local-storage, so to delete local-storage in Chrome, you will need to either manually search for and delete the file in the Local Storage sub-directory in the User Data. You can find it by looking for a file that contains the domain name.

You can also use the Delete cookies and other site and plug-in data entry in the Clear browsing data dialog (chrome://chrome/settings/clearBrowserData or Ctrl+Shift+Delete), however it does not give you fine-grained control at the site level.

For the record, jsfiddle.net does not use local-storage for its frames, it uses standard cookies which you can delete in chrome://chrome/settings/cookies. Just type jsf in the edit box, then click the window_sizes cookie, then the [Remove] button. To delete all cookies at jsfiddle.net, just click the jsfiddle entry (not any spefcific cookie), and press Delete.

1
  • 8
    Think this answer is out of date. On Win 7 in chrome dev panel, on the resources tab you can right click individual local storage entries for a specific site and delete them. Seems to be one at a time, but still works. Chrome Version: 35.0.1916.114
    – BoomShaka
    Jun 9, 2014 at 12:55
8

You can also clear it through the console in the developer window with the command localStorage.clear():

enter image description here

2
  • Is undefined an expected response?
    – Weishi Z
    Jun 21, 2016 at 18:41
  • yes, no problem about that.it removes storage nicely :) @WeishiZeng
    – Sampath
    Mar 5, 2017 at 3:57
6

If you have Chrome Developer Tools you can see or change the localStorage values

  • F12 or CtrlShiftI or OptI
  • Application
  • Storage
  • Local Storage

It is organized by domain. (localStorage is specific to a domain, not a page.)

enter image description here

Highlight the key/value pairs and click X if you want to delete them.

5

I cannot yet comment, but the accepted answer is not 100% accurate anymore since the newest Chrome update. Chrome has got a new material look for all of the settings; and the link to clear all local storage for a specified host is now slightly different:

chrome://settings/siteData
1
  • it's chrome://settings/siteData
    – Sathyajith Bhat
    Oct 23, 2017 at 14:21
1

The answer chrome://settings/siteData did not work for me

This is what works for me in Chrome version 61 :

  1. chrome://settings/content/cookies
  2. scroll down to All cookies and site data, and in the "Search cookies" input enter "localhost"
  3. then click Remove all shown , or hit the delete button

This clears not just cookies but also local storage and your local databases too

2
  • Step 2 points there...
    – Koshinae
    Sep 25, 2018 at 19:18
  • Note on Edge Chromium that you can do this with edge:// prefix instead of chrome:// prefix, but I noticed that it leaves Local Storage intact for Edge Chromium Extensions, which is good because otherwise it might break some of the reserved settings you may have had in your extensions.
    – Volomike
    Feb 11, 2021 at 17:53
1

Clear Local Storage extension

https://chrome.google.com/webstore/detail/clear-local-storage/adilpdccjldjgnipbjmnlgljhlbhkifb/related?hl=en

Then you can just hit Ctrl + Shift + L then Enter and it clears local storage for the current page, and reloads the page.

A shortcut for this is a must when developing certain kinds of websites, so if Chrome won't provide one, an extension is justified.

As mentioned on the documentation, cookies are not cleared, only local storage.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .