There are a handful of situations when clearing Safari's cookies, history, or cache - one of the places where Safari stores website data to avoid having to download it afresh each time you access a site - can help improve your browsing experience.

The first is when sites simply stop working when you access them on Safari. Perhaps Facebook stops updating with new posts, for example, or the images on a site don't appear as they should. If this happens it's likely the cache has become corrupted.

Alternatively, if you find that personal info automatically completed on sites isn't correct, deleting cookies can help. These are small files that sites use to save data about you and what you do on the site.

Even if none of these problems affect you, periodically cleaning browser data can help protect your privacy from snoops who want to discover what sites you've visited recently, or what you've searched for. In this article, therefore, we explain how to clear Safari's cache and history on Mac.

If you want to optimise your Safari experience even more, check out our best Safari tips for Mac, and our favourite Safari extensions and plugins. Also, read our comparison of all the web browsers available for Mac here: Best Mac Web Browser

How to clear Safari history

Safari includes a Clear History tool on the main application menu (click Safari in the top tool bar, then select Clear History), and another at the bottom of the History menu, also selected from the top bar.

You can choose to clear the last hour, or all of today's accumulated data, or today plus yesterday, or just all the data since… Well, forever! Select from the dropdown list and click Clear History.

Although quick to access, the Clear History is badly named because it actually takes a scorched Earth approach - in addition to actual browsing history, it deletes cookies and the entire browser cache too.

Happily, Safari does offer more surgical cleaning tools that let you proceed on a site-by-site basis. It just hides these tools away - but we're here to help. Read next: Best Mac tips, tricks and timesavers

How to clear Safari's cache and history on Mac

Remove individual sites from history

By clicking History > Show All History you'll see a list of the sites you've visited recently; right-clicking any in the list shows a menu complete with Remove option. Alternatively, select any entry in the list and tap the Backspace or Delete key on your keyboard. Note that the Clear History button at the top right of the list displays the same global clear-up dialog box as mentioned above.

Although you can select several entries in the History list in the usual way by holding down Shift or Cmd, you can only delete them by subsequently tapping the Backspace or Delete key on your keyboard. Right-clicking won't work in this instance.

How to clear Safari's cache and history on Mac: Remove individual sites

Clear cookies and cache for individual sites

Cleaning cookies and the cache data for individual sites can be done by opening the Preferences dialog box, then selecting the Privacy icon and clicking the 'Manage Website Data...' button.

You can then prune the list manually by selecting an individual site and clicking the Remove button, or delete all cookies and cache by clicking the Remove All button. There's a search field you can use to track down individual sites.

Bear in mind that deleting cookies might remove autocompleted login usernames and passwords for sites, and will almost certainly log you out of that site if you've configured it to automatically login each time you visit.

How to clear Safari's cache and history on Mac: Privacy

Clean the Safari cache

The hidden Safari Developer menu can be used to clear just the cache, leaving cookies and the browser history in place. This is a very useful diagnostic step to take before removing those two items if a website behaves badly.

The Developer menu can be activated by selecting Safari > Preferences, clicking the Advanced icon, then putting a tick alongside Show Develop Menu in Menu Bar. (This option is right at the bottom.)

A new Develop menu option appears to the left of the Window and Help menu options. Close any open Safari windows and select Empty Caches on the Develop menu. Then click File > New Window to start Safari with a clean cache.

How to clear Safari's cache and history on Mac: Empty caches

Remove autocomplete data from AutoFill

Safari's AutoFill tool, accessible by opening Preferences and clicking the AutoFill icon, sometimes overrides cookies and fills in username and password details on websites. AutoFill might also autocomplete some other information on the site.

To delete any errant data, click the Edit button alongside whichever data type you'd like to remove. The two most useful are 'User names and passwords' and 'Other forms'. In the dialog box that appears once you've clicked Edit, select the site in the list and click the Remove button.

How to clear Safari's cache and history on Mac: Autofill

Delete just site logins

If you've entered the wrong username or password for a site, and Safari subsequently keeps autocompleting it, clicking the Passwords icon within the Safari's Preferences dialog box lets you find it and delete it. Just select the site, then click Remove.

Rather usefully, you can then recreate the entry for the site by clicking the Add button. You'll first need to provide the URL of the site (that is, something like https://facebook.com), and then type the username and password alongside (hit the Tab key to move from field to field).

How to clear Safari's cache and history on Mac: Site logins

Delete logins and passwords system-wide

Pruning site logins can also be done via the Keychain Access app, which you'll find in the Utilities folder of the Applications list in Finder, although you should be very careful using this app because it pretty much controls the entire security operation of your Mac! However, by removing errant username and password entries here you'll stop virtually all of your Mac apps using them, and not just Safari.

Just type the name of the site into the Search field, and look in the list of results for entries of the kind Web Form Password. Right-click the entry and select Delete.

How to clear Safari's cache and history on Mac: Keychain