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 if sites within Safari simply stop working. 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.
How to clear Safari history
Safari includes a Clear History tool on the main application menu (click on Safari in the tool bar), and again at the bottom of the History menu. 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.
However, Safari also offers surgical cleaning tools that let you proceed on a site-by-site basis. It just hides them away.
Removing individual sites from your history
By clicking History > Show All History you'll see a listing of the sites you visited recently and 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 via 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.
Clear cookies and cache data 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 via which you can 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.
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 commencing removal of those two items if a website behaves badly.
The Developer menu can be activated by opening the Preferences dialog, clicking the Advanced icon, then putting a tick alongside Show Develop Menu in Menu Bar (it's right at the bottom of the dialog).
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. Following this, click File > New Window to start Safari with a clean cache.
Remove autocomplete data from Safari 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.
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).
Deleting 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.