Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

How to keep cookies for specific websites only?

more options

I would like to save cookies for a few websites, while having all the others deleted after I close firefox. How do I set it up?

I would like to save cookies for a few websites, while having all the others deleted after I close firefox. How do I set it up?

Chosen solution

cor-el beat me to it!

The usual method is:

(1) Change the default cookie lifetime from "however long the website wants" to "current session only"

(2) Create exceptions on a site-by-site basis as needed

(3) Do not use any other method of clearing cookies, since the current session only cookies will be culled automatically

For #1:

  • Windows: "3-bar" menu button (or Tools menu) > Options
  • Mac: "3-bar" menu button (or Firefox menu) > Preferences
  • Linux: "3-bar" menu button (or Edit menu) > Preferences
  • Any system: type or paste about:preferences into the address bar and press Enter/Return to load it

In the left column, click Privacy & Security. On the right side, set "Firefox will: Use custom settings for history" and then:

[X] Accept cookies from websites Accept third-party cookies: Always Keep until: I close Firefox [_] Clear history when Firefox closes

For #2:

You can use the Exceptions button on the Options page, but the formatting can be particular. It may be easier to use the Permissions panel of the Page Info dialog while you're on the site that should be allowed to set cookies. You can call that up using either:

  • right-click a blank area of the page and choose View Page Info > Permissions
  • (menu bar) Tools menu > Page Info > Permissions

Scroll down to "Set Cookies" and uncheck the "Use default" box, and then select the permission you prefer (in this case, "Allow").

Changes are saved as you go, so you can close this dialog when you're finished.

For #3:

Make sure "Clear history when Firefox closes" is not checked. Or, if you want to clear cache or other data, click the Settings button to the right and make sure that neither Cookies nor Site Preferences is checked.

  • Cookies: does not obey exceptions, removes everything
  • Site Preferences: these are your exceptions, don't remove them

Does that work for you?

Read this answer in context 👍 1

All Replies (2)

more options

Let the cookies expire when Firefox is closed to make them session cookies instead of using "Clear history when Firefox closes" to clear the cookies.

  • Options/Preferences -> Privacy & Security -> "Use custom settings for history" -> Cookies: Keep until: "I close Firefox"

You can create an "Allow" exception to keep specific cookies.


In case you use "Clear history when Firefox closes" or otherwise clear history.

  • do not clear the Cookies
  • do not clear the Site Preferences
  • clearing "Site Preferences" clears exceptions for cookies, images, pop-up windows, and software installation and exception for password and other website specific data
  • clearing "Cookies" will remove all selected cookies including cookies with an "Allow" exception you may want to keep
more options

Chosen Solution

cor-el beat me to it!

The usual method is:

(1) Change the default cookie lifetime from "however long the website wants" to "current session only"

(2) Create exceptions on a site-by-site basis as needed

(3) Do not use any other method of clearing cookies, since the current session only cookies will be culled automatically

For #1:

  • Windows: "3-bar" menu button (or Tools menu) > Options
  • Mac: "3-bar" menu button (or Firefox menu) > Preferences
  • Linux: "3-bar" menu button (or Edit menu) > Preferences
  • Any system: type or paste about:preferences into the address bar and press Enter/Return to load it

In the left column, click Privacy & Security. On the right side, set "Firefox will: Use custom settings for history" and then:

[X] Accept cookies from websites Accept third-party cookies: Always Keep until: I close Firefox [_] Clear history when Firefox closes

For #2:

You can use the Exceptions button on the Options page, but the formatting can be particular. It may be easier to use the Permissions panel of the Page Info dialog while you're on the site that should be allowed to set cookies. You can call that up using either:

  • right-click a blank area of the page and choose View Page Info > Permissions
  • (menu bar) Tools menu > Page Info > Permissions

Scroll down to "Set Cookies" and uncheck the "Use default" box, and then select the permission you prefer (in this case, "Allow").

Changes are saved as you go, so you can close this dialog when you're finished.

For #3:

Make sure "Clear history when Firefox closes" is not checked. Or, if you want to clear cache or other data, click the Settings button to the right and make sure that neither Cookies nor Site Preferences is checked.

  • Cookies: does not obey exceptions, removes everything
  • Site Preferences: these are your exceptions, don't remove them

Does that work for you?

Modified by jscher2000 - Support Volunteer