There are a handful of situations when deleting Safari's site data can be useful. This 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. The cache is one of the places where Safari stores website data to avoid having to download it afresh time you access the site.
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 all Safari's data
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.
However, Safari 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 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 at the bottom left of the list displays the same global clear-up dialog box as mentioned in point 1, 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 just 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 Details button alongside the heading that reads X Websites Stored Cookies and Other Data. 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 what data you'd like to remove. The two most useful are the User Names and Passwords heading, and the Other Forms heading, which lets you clear other website autofill data. 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 systemwide
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.