52

Note that this is NOT the Cache folder. It's the Cache of Service Worker, the path should be AppData\Local\Microsoft\Edge\User Data\Default\Service Worker.

Recently I noticed my hard drive is almost full so I want to clean it up. I noticed the while the Cache folder is acceptable (200MB), the cache of Service Worker folder is so big (> 1GB). I tried unregister all the service workers but the cache folder is still there.

Can I safely just delete them from Windows Explorer?

P.s: as a developer, I am amazed by the amount of registered service workers. Most of them are trackers and useless stuff I should have removed before.


I have read this article but it didn't work for me because:

  • I don't want to delete cookies as well, I need them. Unfortunately Chrome/Edge group that into one option.

  • I can't just go to each website to delete individual Service Worker cache.

4
  • Please kindly check if this thread was helpful to you: Clearing Service worker cache
    – Sunny
    Commented Dec 8, 2020 at 10:03
  • Hi sorry I forgot to mention that yes I have read that article. I will update the question. And no, it doesn't work for me.
    – Luke Vo
    Commented Dec 8, 2020 at 11:13
  • 2
    Seel also chrome://settings/content/all
    – mems
    Commented Aug 24, 2023 at 12:39
  • @mems good one. I had to check in Chrome. MS Edge doesn't have the Clear Data button.
    – Luke Vo
    Commented Aug 24, 2023 at 16:46

5 Answers 5

34
+25

My own Service Worker cache is found at the folder:
C:\Users\USER-NAME\AppData\Local\Microsoft\Edge\User Data\Default\Service Worker\CacheStorage\3cedfb74d44f2e84198d23075aef16c34a668ceb.

I have tried to clean it up using in edge://settings/clearBrowserData the option of "Cached images and files", but this didn't touch the Service Worker cache.

So I just went into the above folder with explorer and deleted all its contents, but left the folder itself in place.

Then I started Microsoft Edge, and it started without any problem. It also re-populated the folder with new content.

So my answer is: Yes, you can delete it from Explorer.

If you are worried about safety, you may at first step move the contents to a temporary folder and run Microsoft Edge. If everything works well, you may then delete the temporary folder.

Note: Google Chrome behaves in exactly the same way. Its cache is found at:
C:\Users\USER-NAME\AppData\Local\Google\Chrome\User Data\Default\Service Worker.

4
  • 3
    Tip: you can just put this into address bar or Run dialog (Windows + R): %appdata%\..\Local\Microsoft\Edge\User Data\Default\Service Worker\CacheStorage. You don't have to worry about username.
    – Luke Vo
    Commented Mar 7, 2021 at 17:38
  • 4
    @LukeVo awesome tip can be simplified further by using %LocalAppData% instead of %appdata%\..\Local (in some configurations it can be different locations and then %LocalAppData% is the more correct one)
    – NiKiZe
    Commented Jun 23, 2021 at 8:06
  • Tried with Google Chrome on Linux, worked fine and websites work just like before. I wonder why the ServiceWorker cache is not in Chrome's cache folder
    – golimar
    Commented Feb 23, 2022 at 6:26
  • Also I am tired of periodically clean up this cache, it grows back so quickly. So now I installed a Chrome extension that blocks all Service Worker by default and whitelist websites that actually need it. See my answer below.
    – Luke Vo
    Commented Nov 13, 2023 at 23:57
28

@harrymc has answered how to brute-flush your cache. Here's a method to go website-by-website, understanding a bit more about what's going on.

Ìf you insert [chrome/edge/vivaldi/...]://serviceworker-internals/ into the address bar, you can see all registered service workers. However, unregistering them thorugh that page won't clear the cache, as this comprehensive article on love2dev notes.

Instead, if for example youtube.comhas registered a serviceworker, navigate to that website and open the developer console. Open the 'Application' tab and the 'Storage' item.

developer console - Application - Storage

Here, you'll see how much storage your service worker occupies, and you can select which data to clear for that website, for example retaining only the cookies.

Note that the service worker will restart as soon as you navigate to that site again.

If you wish to choose which applications can install a service worker on your system, follow the steps described in this article, using the uBlock plugin.

It's a wild guess, but 5GB of ServiceWorker storage is probably some webmail client with offline content enabled: it is fundamental to understand that serviceworkers were initially conceived for mobile devices who are not always online, and thus will cache some web-application data on the local system. Also, a serviceworker can receive push messages for an inactive webapp, and wake up that app. Gmail is a prime example: on mobile, you can read & write email while offline, and it will sync as soon as you go online. And even if the gmail app is not active after a phone restart, the serviceworker will receive the push message that you have something new in your inbox.

As such, on a PC which is always connected to internet, serviceworkers are not really necessary, except maybe to speed up the experience on some websites. It could however be that nowadays some websites simply won't work correctly if you block their serviceworker (but I'd say that's bad coding practice).

For a more comprehensive understanding, read the two linked articles. Also, Googles Introduction to Service Workers can shed some more light on what's going on.

2
  • Rather than (similar to?) a webmail client, the 2 sites which were taking up 1.5 GB on my machine were MS Teams and MS SharePoint sites we use in my organization. Commented Sep 27, 2022 at 7:18
  • I think the features is fine in theory but Chrome should definitely implement UI to clear the service worker storage. That's technically a cache because the browser can just reload everything the next time. Commented Apr 5 at 7:57
6

A safer solution to clear that folder: In chrome/edge/vivaldi, go to "Settings" -> "Privacy and Security" -> "Cookies and other site data" -> "See all cookies and site data", you will get a list of all sites, which have saved data on your computer. Some is only cookies, but some will have "Local storage" or "Database storage".

It is possible to check each item, for how much storage is used. You may use "remove all", to delete everything, but be aware that all cookies and similar are also deleted.

5
  • 1
    Yeah the problem is cookies though. Usually I don't want to re-login everything (and accept/reject all those darn cookie popup again)
    – Luke Vo
    Commented Sep 29, 2022 at 4:53
  • 1
    From what I understand this doesn't clean that folder.
    – jayarjo
    Commented Nov 1, 2022 at 12:13
  • @jayarjo It did for me, maybe you have more than one profile?
    – boussouira
    Commented Nov 2, 2022 at 13:02
  • This also worked for me (well, in my case using the little dropdown to the left of the address-bar, but they do the same thing, for the open domain); however, it also deleted the other storage for the site, meaning I lost the setting customizations I had made. So, I recommend one of the other approaches, to clear only the service-worker cache (not the rest of the local storage, eg. setting customizations).
    – Venryx
    Commented Jun 25, 2023 at 19:25
  • This isn't a viable solution for the question as it was asked. It specifically says that deleting cookies isn't desired, and as stated in this answer, it would delete cookies also.
    – Elezar
    Commented Aug 16, 2023 at 17:45
5

You can go to chrome://settings/content/all and order by Data Stored, as it will show all the websites taking most data on your Worker Cache. enter image description here

0

To add to the current answer that it's safe to clear the cache, I am tired of periodically clean up that cache and it grows so quickly. I use a Chrome extension to block all Service Workers. It should have a whitelist feature because some websites actually need them and you trust them. This has another positive impact as a lot of trashy service workers are installed by trackers as well.

Just search for Service Worker blocker on Google or Chrome Webstore (so I do not advertise a single one).

Also to add from the comment, you can quickly access the cache folder with this path: %localappdata%\Microsoft\Edge\User Data\Default\Service Worker\CacheStorage

You must log in to answer this question.

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