Why you may want to clear the Firefox cache from time to time

Martin Brinkmann
Nov 20, 2013
Updated • Aug 23, 2018
Firefox
|
21

I recently noticed a big drop in available disk space on my computer's main hard drive. Since it is a Solid State Drive with only 128 Gigabytes of storage, I'm observant when the available storage drops below the 10% mark on the drive.

A drop in available space can come quicker than you think, for instance by using a tool to convert videos to DVD movies.

Since most programs use the C: drive as a temporary space for conversions, and also to place the finalized product on, it has happened in the past that a single conversion dropped storage space by nearly 10% as well.

This time though, things were not as easy to find out at first. I noticed that the space dropped below the 10 Gigabyte mark, which is problematic if you are running a SSD as it may have an impact on the drive's performance.

Whenever I want to analyze the disk space, I use a program like TreeSize Free to do so. While it is certainly possible to browse folders and files manually, it simply takes to much time to be effective.

I noticed a huge Mozilla Firefox profile directory after the scan. The directory used more than 9 Gigabytes of space.

Update: As some users pointed out, the large cache directory has been caused by an experimental feature that is only available in Firefox Nightly, and not in other versions of the web browser. It is still a good idea to check the size of the cache regularly to make sure that it does not overflow.

firefox using lots of space

Further investigation revealed that the majority of space was used by the cache2 directory of the profile folder, indicating that it was temporary data that was taking up that much space on the system.

I decided to clear the browser cache using Firefox's own delete history menu. The use of the Ctlr-Shift-Del shortcut displayed the window, and I configured it to delete all cached files of the browser.

clear-cache

To my surprise, it only cleared about 1.3 Gigabytes of cached files in the profile folder, which meant that about 8 Gigabytes were still stored in the folder. Puzzling, to say the least.

I decided to look in the cache2 folder manually, and found only a couple of leftover files in there. This meant that the cache had been cleaned successfully, and that TreeSize Free had not updated its display properly.

I restarted the application and it too did display the correct cache amount afterwards.

Closing Words

Almost 9 Gigabytes of cached files is a lot. I'm not entirely sure why Firefox accumulated that much storage space in first place.

I made the decision to configure the browser to clear the history automatically on exit, to make sure that I would not run into the issue again at a later point in time.

You can do so in the following way:

  1. Tap on the Alt-key on your keyboard to bring up the menu bar.
  2. Select Tools > Options from the menu.
  3. Switch to the privacy tab here and select "Use custom settings for history" under History.
  4. Check the "Clear history when Firefox closes" box and click on Settings afterwards.
  5. Check "cache" at the very least and click ok.
  6. Note, if you select cookies, your signed in sessions on websites and services are removed, which means that you will have to sign in again the next time you use them.
  7. If you select Browsing & Download History, Session Restore won't work. This means that the tabs from last session won't be opened and that you cannot restore them either.

clear history when firefox closes

Now Read: Try these fixes if Firefox is slow

Summary
Why you may want to clear the Firefox cache from time to time
Article Name
Why you may want to clear the Firefox cache from time to time
Description
The article explains why you may want to check the size of the Firefox cache from time to time, and to clear it as well.
Author
Publisher
Ghacks Technology News
Logo
Advertisement

Tutorials & Tips


Previous Post: «
Next Post: «

Comments

  1. Nebulus said on November 21, 2013 at 2:43 pm
    Reply

    I always disable the Firefox’s disk cache, because I see no real need for it.

  2. Ken Saunders said on November 21, 2013 at 1:37 pm
    Reply

    “the space dropped below the 10 Gigabyte mark”
    So are you a data pack rat? :)
    I am.

    I too wonder how it got enabled.
    browser.cache.use_new_backend
    should be 0

    1. Martin Brinkmann said on November 21, 2013 at 1:41 pm
      Reply

      Well I know that I did enable it but forgot about it ;)

  3. anonymous said on November 21, 2013 at 1:30 am
    Reply

    You can also configure Firefox to cache only to ram, not the hard drive. This can help with optimization and privacy. However, it is recommended that you only cache to ram if you have at least 1 gigabyte of ram.

    This add on can configure Firefox to cache only to ram for you: https://addons.mozilla.org/en-US/firefox/addon/calomel-ssl-validation/

    More information on the ram feature and the rest of the add on: https://calomel.org/firefox_ssl_validation.html

    1. Martin Brinkmann said on November 21, 2013 at 9:19 am
      Reply

      Interesting, thanks!

  4. InterestedBystander said on November 20, 2013 at 6:38 pm
    Reply

    Firefox’s caching may also cause problems with Moodle, the widely used instructional student/teacher application. After several Moodle freezes the university IT staff recommended my wife clear Firefox’s cache before she starts work on her instructional data. (She uses a Mac, FWIW.)

  5. beachbouy said on November 20, 2013 at 6:30 pm
    Reply

    I always enter browser preferences and limited by browser cache to 256Mb or less. If I had a slow internet service or was bandwidth metered by my ISP, allowing a large browser cache might be of some value. Otherwise, I see little or no benefit to allowing my browser cache to consume gigabytes of storage space.

  6. Niks said on November 20, 2013 at 6:22 pm
    Reply

    How did you make cache size so large ? Mine goes only till 1 gb . Can’t set more than that in Settings –> Advanced–> Network –> Cached web content .

    1. Martin Brinkmann said on November 22, 2013 at 1:13 pm
      Reply

      It is an experimental cache that needs to be activated in Nightly: https://www.ghacks.net/2013/09/23/mozilla-launches-firefoxs-new-caching-back-end-nightly-version/

  7. Oxa said on November 20, 2013 at 5:07 pm
    Reply

    Ah, found some further info. Appears that cache2 is experimental and those who don’t use a nightly build won’t have such a folder.
    http://forum.piriform.com/?showtopic=39751
    http://www.janbambas.cz/mozilla-firefox-new-http-cache-is-live/

  8. hessam said on November 20, 2013 at 5:04 pm
    Reply

    i keep my cache in firefox but always delete old cache with below addon

    https://addons.mozilla.org/en-US/firefox/addon/precise-clear-history/

  9. Srap said on November 20, 2013 at 5:02 pm
    Reply

    One has to flip a pref in about:config to enable it, so this only a problem for people who enabled it. The bug is known for Moz, I think it is bug No. 913808
    Cache2 is a rewrite of the current cache, designed to better in certain aspects. It is under active development and is disabled even in Nightly. More can be read about it on http://www.janbambas.cz/

  10. Aprimosis said on November 20, 2013 at 4:39 pm
    Reply

    I like your site and articles in general but this article is pointless because cache2 folder is created in mozilla directory only when you are using testing versions of the browser and manually enabled new testing cache feature in about:config. And if you are done so, you should already know there are some issues with new cache and bugs are already filed on bugzilla website.

    Don’t use features you have no knowledge of (and spread false rumors why you need to clear cache in firefox). In normal usage of firefox cache folder is limited to 1024 MB.

    1. Martin Brinkmann said on November 20, 2013 at 10:52 pm
      Reply

      It is not a false rumor and the article is not claiming that Firefox is using more cache space than other browsers. And even if it is an experimental feature, it may help others who ran into the same issue.

      I have added an update to the article to reflect that this has been caused by an experimental feature.

  11. Oxa said on November 20, 2013 at 4:33 pm
    Reply

    What’s cache2? I don’t have that folder, only Cache.

    1. hum said on November 20, 2013 at 6:46 pm
      Reply

      It’s only in Nightly, and currently disabled by default, iirc.

    2. Ahmad said on November 20, 2013 at 6:06 pm
      Reply

      Its new cache mechanism firefox adding to improve cold startups and also warm startup, not to mention it will reduce Disk I/O and thrashing as well.

      @Martin
      You should not enable new cache mechanism on SSD yet because it does not have any eviction policy. It will be bad for SSD write cycles.
      Premature feature, so don’t go for it until Honza (developer) add eviction policy.

    3. Dexter said on November 20, 2013 at 5:27 pm
      Reply
  12. Classic said on November 20, 2013 at 4:30 pm
    Reply

    From where did you get the cache2 folder? :)
    I don’t have one. I only have Cache folder and all cache files are stored in it…

    1. Martin Brinkmann said on November 20, 2013 at 10:54 pm
      Reply

      It is an experimental feature.

    2. Martin Brinkmann said on November 20, 2013 at 10:54 pm
      Reply

      It is an experimental caching feature in Firefox.

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.