How to clear Chrome Service Worker cache?


👤 Diwas Poudel    🕒 11 Mar 2023    📁 FIX

A service worker is a script that your web browser runs in the background, independently of a web page, and does not require user interaction.

Service Workers are useful because they make it possible for websites and web apps to load their content more quickly, irrespective of the network that is being utilized. They make it possible with the help of offline access, push notifications, background sync, and many other additional capabilities coming with Service Worker.

Service employees are responsible for the storage of objects that have been brought back from visited sites and retained locally for a variety of reasons. This ensures that loading is done as quickly as possible. Items may be stylesheets, scripts, HTML, photos, or any one of a wide variety of other assets.

Working of Service Worker
fig. Working of Service Worker

Service Worker Cache is a form of cache used by Chromium-based browsers to store static page contents such as images, scripts, stylesheets, and other resources for faster loading and offline access.

Due to this, the Service Worker Cache Storage folder consumes a lot of disk space and you want to clear it. Clearing this from the individual website one by one is not a viable solution and want to clear it all at a time then you are in right place.

Clearing the Service Worker cache can fix website issues like outdated content or broken scripts. Clearing the cache improves browser speed and frees up computer storage.

I also faced the same problem, When I used File System Visualization Tools and found that the service worker cache storage folder is taking up a significant amount of space on the disk. And you just want to clear Service Worker Cache and nothing other cookies and other things. If the same happens to you then ourtechroom will guide you to clear those Service Worker Cache on your Chrome Browser.

📚 Also, note that: Clearing Browser Cache does not clear the Service Worker Cache.

How to clear chrome service worker cache using Chrome built in feature?

Chrome has built in features which let us clear service worker cache and the steps are as follows:

Note: This works on Windows ,Linux as well as Mac if you have chromium based browser.

Steps:

  1. Open Chrome DevTools by pressing F12 in Chrome.
  2. Select "Application" in DevTools.
  3. Click "Clear storage" under "Storage" in the left column.
  4. Uncheck any other boxes if you do not want to clear other types of storage.
  5. Click "Clear site data" to clear Service Worker cache.
    Clearing Service Worker Cache
    fig. Clearing Service Worker Cache using Chrome built in feature

How to clear the chrome Service Worker Cache in Windows?

Here are the steps to clear the chrome Service Worker Cache in Windows.

1 Open File Explorer and at the top type below and press Enter

%userprofile%\AppData\Local\Google\Chrome\User Data

Here you will see the various folder and we are interested in the Default and Profile X (x can be 1,2,3 ...) folder.

2. Go inside the Default folder and search for the Service Worker folder and just delete all the content inside it, especially the CacheStorage

 folder.

service-worker-content-delete
fig. Delete everything inside the service worker folder

3  Again come back to the User Data folder, and then go to the Profile X folder and find Service Worker Folder and just delete all the content inside it. And do this for all the Profiles available like Profile 1, Profile 2, and soon.

Alternatively, you can directly navigate to the given below path and delete it from there.

%LocalAppData%\..\Local\Google\Chrome\User Data\Default\Service Worker\CacheStorage
Also read: How to clear the cache on windows 10 | Ultimate Guide

How to clear the chrome Service Worker Cache in macOS?

You can navigate to the following path and delete everything.

~/Library/Application Support/Google/Chrome/Default/Service Worker

How to clear the chrome Service Worker Cache in Linux?

You can navigate to the following path and delete everything inside it, especially CacheStorage.

~/.config/google-chrome/Default/Service Worker/
Also read : Chrome: Memory Cache vs Disk Cache 

Clear Service Worker Cache using Chrome Extension

One of the best Chrome Extension for Clearing Service Worker Cache is Clear Cache for Chrome 

This extension will clear the Service Worker Cache in addition to the Navigation History, Cookies, Download History (but not the download history for files), Local Storage, Passwords, IndexedDB, and so on.

How to remove service worker cache for specific site?

For this we can use Developer Options and the steps are follows:

  1. To do this, hit F12 to bring up the Developer Tools, then select the "Application" tab.
  2. Navigate to "Service Workers" in the left-hand toolbar, and then on right side click on "See all registrations" link.
    see all registrations for service workers
    fig. see all registrations for service workers
  3. Next click on "Unregister" to deactivate the Service Worker for your desire site.
    Unregister cache for Specific site
    fig. Unregister cache for Specific site

Likewise, this will flush the site's Service Worker database.

How to clear cache and browsing data in Chrome ?

Steps are as follows:

Chrome Settings > Privacy and security > Clear browsing data will clear the Service Worker cache and other browsing data. Select "Cached images and files" to erase the Service Worker cache.

Please be aware that after clearing the cache, it may take some time for webpages to fully load, as they will need to re-download any previously cached data.
How often should I clean Chrome Service Worker cache?

A: It relies on your browsing habits. If you use multiple browsers or view frequently changing websites, you may want to clear the cache more often. Otherwise, clean the cache monthly.

Conclusion:

In these ways, we can clear the service worker cache in Chrome Browser.