How to auto-delete cookies in Safari when you close a tab

Updated · by Sufiyan Yasa, developer of Cookie DNT

Short answer: Safari can't delete cookies automatically when you close a tab or quit. Your options are Private Browsing (deletes everything, logs you out of everything), clearing history by hand, or a Safari extension like Cookie DNT that deletes cookies only for the sites you pick.

Firefox has “Delete cookies and site data when Firefox is closed”. Chrome has a setting to clear site data when you close all windows, and the Cookie AutoDelete extension. Safari has neither. People have asked Apple for it on the support forums for over a decade.

So what can you do?

Option 1: Private Browsing

A Private Browsing tab keeps its cookies only while it’s open. Close the tab and its cookies are gone.

The catch: every site forgets you, including email, your bank and anything else you want to stay logged into. Most people give up on it after a day.

Option 2: Clear history and website data by hand

The catch: it’s manual, and it wipes every site at once - your logins and your history go too. See how to clear cookies on iPhone for a version that keeps history.

Option 3: A Safari extension that deletes per site

This is how Cookie AutoDelete works on Chrome and Firefox, and it’s what Cookie DNT does in Safari:

  1. Install Cookie DNT and turn on its extension in Safari.
  2. Visit a site you don’t want remembering you, open the extension menu, and switch Enabled on.
  3. When no tab is on that site any more, Cookie DNT deletes its cookies, localStorage, sessionStorage and IndexedDB.

Sites you never switch on keep their cookies, so you stay logged in. If you’d rather clean everything by default, turn on Block All Mode in the app and add the sites you want to keep to the allow list (wildcards like *.example.com work).

You can also set a timer instead of waiting for the tab to close - anything from a few seconds to hours.

Which should you use?

You want… Use
Nothing saved, ever Private Browsing
A one-off clean slate Clear History and Website Data
Logged in to some sites, forgotten by the rest A per-site extension like Cookie DNT

Does Safari’s tracking prevention already do this?

Partly. Safari’s Intelligent Tracking Prevention limits third-party cookies and caps how long some first-party cookies set by scripts can live. It doesn’t delete a site’s cookies when you leave it, and it doesn’t touch the cookies the site sets for itself to recognise you next time.