3 Simple Ways to Recover Deleted Safari History on Mac

Reciver deleted Safari history

When most Mac users delete their Safari browser history, the last thing they want is for it to ever come back. But from time to time, users clear their browsing history on accident or realize that it contained an important website whose address they don’t remember anymore.

If you’re currently in the same situation, then this article will help you solve it because it describes the top 3 ways to recover deleted Safari history on Mac. But before we get to them, we need to briefly explain what Safari browser history actually is and where you can find it.

What Is Safari History and How to Find It?

Safari history is a database containing previously visited websites. Just like most other web browsers, Safari keeps it automatically to make it easier for users to revisit familiar websites without having to enter their addresses over and over again.

To view Safari history: 

  1. Open Safari on your Mac.
  2. Choose the History option.
  3. Click Show All History

Safari history

You should see a table with two columns and multiple rows. The first column from the left shows the names of previously visited websites, while the second column shows their addresses. Individual entries are grouped by date, so you can easily go back in time and view history on Safari Mac from a specific date. Alternatively, you can use the search bar in the top-right corner to find all history entries that contain specified keywords.

All the information that you can see when you click the Show All History button is stored on your hard drive, inside a file called History.db. This file is located in the ~/Library/Safari/ folder.

To find and open the History.db file: 

  1. Open Finder.
  2. Choose the Go option.
  3. Click Go to Folder.
  4. Enter the path to the Safari history file location in the textbox and click OK.
  5. Open History.db with TextEdit.

History.db inTextEdit

You will see a long text file that’s anything but easy to decipher. That’s because History.db is actually an SQLite database file, and it’s not intended to be viewed in a regular text editor. Instead, you should open it using a database browser like DB Browser for SQLite, which you can download for free right from its official website.

After installing DB Browser for SQLite, launch the app and click Open Database. Select the History.db file and switch to the Browse Data tab. Finally, select the history_items table.

View History.db in DB BrowserYou should see a rather nicely formatted list of URLs and corresponding domain names, and you can sort it alphabetically.

How Can Safari History Be Deleted and When It Can Be Recovered?

Let’s take a look at some common reasons for deleting Safari history and whether it can be recovered:

  • 🎯 Intentional deletion: Many Safari users like to keep their browsing history squeaky clean to prevent others from examining their online activity. That’s all fine and good until you need the address of a website you’ve visited a long time ago and can’t remember it.
  • 🩹 Accidental deletion: All you need to do to delete your Safari history is click the Clear History button and confirm your decision. By default, Safari deletes only the last hour of browsing history, but you can also tell it delete all history in one go. What often happens is that users want to delete only the last hour but don’t notice that the option to delete all history is selected, causing their entire browsing history to disappear immediately.
  • 🔐 Private Browsing: Safari allows you to open a Private Window (Command+Shift+N) that prevents your browsing history from being recorded. Safari users sometimes don’t realize that they’re browsing the web in the Private Window and wonder why their browsing history hasn’t been recorded.
  • 🗃️ Formatting: When reinstalling macOS, it’s sometimes a good idea to first format the system drive to start with a clean slate. It goes without saying that formatting doesn’t erase just Safari history but also all other files stored on the hard drive.
  • 👾 Hackers: Mac users are relatively safe from malware since most cybercriminals target Windows computers, but that doesn’t mean they are completely immune. From ransomware to remote desktop hacks, there are multiple cyber-threats that can cause Mac users to lose their entire Safari browsing history in the blink of an eye.
Fortunately, in all the above-described situations—with the exception of Private Browsing (which prevents browsing history from being recorded) — it’s possible to restore Safari history using native tools and third-party software

How to Perform Safari History Recovery?

There are three main methods for recovering Safari history on Mac, and we describe all of them in the same order we recommend you try them.

Method 1: Use Disk Drill

Disk Drill is perfect for recovering a History.db that has been accidentally deleted or lost during formatting. As long as the file hasn’t been overwritten, you should be able to completely recover it.

To restore deleted history of Safari browsing with Disk Drill: 

  1. Download and install Disk Drill for Mac. Install Disk Drill
  2. Launch Disk Drill and select your main hard drive.
  3. Click Search for lost data. Scan the disk
  4. Type “history.db” into the search field in the top-right corner and hit Return.
  5. Select the deleted History.db file and click the Recover button. Find History.db file and recover
  6. Choose a safe recovery destination and click OK.

You can then view deleted Safari history in your favorite text editor or database browser. To view it in Safari, you need to copy the recovered History.db file to ~/Library/Safari and overwrite the file that’s currently in the location.

Method 2:Restore from iCloud backup

If you’re using iCloud to back up your Safari data and keep it synchronized across devices, then you can recover deleted Safari history using your iPhone or any other iOS and iPadOS device that still contains the original browsing history data.

Here’s what you need to do: 

  1. Open the Settings app on your iPhone or iPad.iPhone settings
  2. Tap on your name.
  3. Select iCloud.
  4. Locate Safari and toggle the switch next to it until you’re prompted to merge your data.
  5. Click Merge. Merge safari data with iCloud

This way, you force your iPhone to overwrite Safari browsing history in iCloud, which, in turn, allows you to recover deleted Safari history on Mac just by turning on the Safari option in iCloud settings (see the last section of this article for a step-by-step guide).

Method 3: Restore from Time Machine backup

Safari history recovery can also be performed using Time Machine. While you could choose the nuclear option and restore your entire Mac to an earlier state from Recovery, it’s much less time consuming to only recover the History.db file, which, as we’ve explained earlier in this article, contains all previously visited websites and is stored in the ~/Library/Safari directory.

To restore deleted history of Safari browsing using Time Machine: 

  1. Close Safari
  2. Open Finder and select Go -> Go to Folder.
  3. Enter ~/Library/Safari and click the Go button.Open safari folder
  4. Scroll down until you find the History.db file and select it.
  5. Click the Time Machine icon located in the Menu Bar and choose Enter Time Machine.Enter time machine
  6. Go back in time until you see a version of the History.db file that contains your lost Safari browsing history.
  7. Click Restore to restore the selected file.Restore History.db file

The next time you open Safari, your browsing history should be back. That’s how easy it is to retrieve deleted history of Safari browsing using Time Machine.

The only problem with this method is that it will work only if Time Machine was enabled prior to the data loss incident. If it wasn’t, then you won’t have any backup of the History.db file to recover.

How to Prevent Safari History Loss?

The best way to prevent Safari history loss is to turn on Safari in iCloud preferences. That way, iCloud will automatically back up your Safari data to the cloud, allowing you to keep it synchronized across your devices and easily retrieve it should anything happen to your Mac.

To back up your Safari browsing history with iCloud: 

  1. Open the System Preferences app on your Mac.
  2. Select iCloud.
  3. Check Safari. Back up Safari history in iCloud

Your Safari browsing history will be automatically synchronized across all Apple devices that use the same Apple ID.

FAQ

Use this simple procedure to recover closed or deleted Safari tabs on an iPhone.

  1. Open Safari and tap the Tabs button in the bottom-right corner. (It’s two overlapping squares)
  2. Tap and hold the Plus (+) button at the bottom of the screen.
  3. A list of the recently closed tabs is displayed. Tap an item to open it in a new tab.
  4. Save the tab as a bookmark to ensure it never gets lost.

You can use the following procedure if you have backed up your iPad to iCloud.

  1. Select Settings > General > Reset on your iPad.
  2. Choose Erase All Content and Settings.
  3. Follow the setup prompts and select the Restore from iCloud Backup option in the Apps & Data screen.
  4. Sign in to iCloud and select a backup that has your deleted Safari history and use it to restore your device.

You can use data recovery software like Disk Drill to recover your deleted Google Chrome history with the following procedure.

  1. Install Disk Drill on your Mac.
  2. Connect the iPhone to your computer.
  3. Launch Disk Drill and select the iPhone from the disk list.
  4. Click the Search for lost data button to scan the device.
  5. Preview the found files and look for a Google Chrome History and Preferences file.
  6. Select the file to be restored and click the Recover button.
David Morelo is a seasoned technology writer with a decade of professional experience and a Bachelor's degree in English Linguistics. He also holds a Google Cybersecurity Certificate. At Macgasm, he mainly writes product reviews and in-depth guides, with a focus on macOS and iOS. David's tech journey began at the age of 11, when he assembled his first Windows PC and later used it to explore the Linux world. His curiosity eventually led him to the Hackintosh community and, soon after that, to the nearest Apple store. Today, he's an avid Mac and iPhone user who enjoys the coziness of the Apple software ecosystem because it helps him stay productive. His contributions have also been featured on platforms like CleverFiles, Make Tech Easier and Insanely Mac, and many others.