Prasit Mankad

Your deleted browser history is not gone

SQLite marks deleted rows as available space but does not erase the bytes. I recovered 153 URLs from Brave after accidentally clearing my history.

I cleared my Brave browser history by accident. Months of browsing, research tabs, reference links. Gone, according to the browser. Not gone, according to the underlying database.

I recovered 153 distinct URLs. Here’s how.

How Brave stores history

Brave’s browsing history lives in a SQLite database at ~/.config/BraveSoftware/Brave-Browser/Default/History. SQLite stores data in fixed-size pages. When you delete a row, the database marks that page as available for reuse. The actual bytes stay in the file until a new write overwrites them.

This is standard SQLite behavior, not a Brave quirk. The same applies to Firefox, Chrome, and any other application that uses SQLite for storage.

When you click “Clear browsing history” in Brave, the rows are deleted from the database tables. The pages those rows occupied are marked free. But if you haven’t done much browsing since the deletion, those pages haven’t been overwritten yet. The data is still there.

What I did

I ran an AI-assisted forensics session. I described the problem to the AI, and it wrote a Python script to read the raw database file, identify pages marked as free, parse URL records from the raw bytes, deduplicate the results, and write them to a text file.

The script worked on the first attempt with minor adjustments. The AI knew the SQLite page format well enough to write the byte-parsing logic correctly. I wouldn’t have written that from scratch in under an hour; the AI had a working draft in about two minutes.

The result: 153 distinct URLs recovered. I opened 76 of them in tabs. The other 77 were obviously irrelevant — ad trackers, analytics endpoints, things I’d never intentionally visited.

The recovery window

Immediately after deletion, nearly everything is recoverable. The pages are marked free but haven’t been touched.

After continued browser use, the recovery rate drops. Every new page you visit writes new data to the database. Some of those writes land on the freed pages and overwrite the deleted records. The longer you wait, the less you get back.

After running VACUUM on the database, recovery becomes much harder. VACUUM rewrites the entire database file, compacting it and removing all free pages. The deleted data is gone at that point.

I got lucky. I noticed the accidental deletion quickly and stopped browsing immediately. If I’d kept using the browser for a few hours before trying to recover, the results would have been worse.

The privacy implication

“Delete” in most applications means “mark as available,” not “erase.” This is true for browser history, but it’s also true for Signal message history, any app using SQLite for local storage, and any file you delete from a filesystem. The filesystem marks the blocks as available; the bytes stay until something else writes over them.

If you want data actually gone from a SQLite database, run VACUUM after deleting. If you want a file actually gone from disk, use a secure deletion tool that overwrites the blocks before releasing them. The standard delete operation in any OS or application is not a security measure.

This is also why disk recovery tools work. When you delete a file, the filesystem removes the directory entry and marks the blocks as free. The data on those blocks is untouched. A recovery tool scans the raw disk, finds blocks that look like file data, and reconstructs them. The same principle, one level down.

The practical takeaway

If you’ve accidentally deleted something from a SQLite-backed application, stop using the application immediately and try to recover before any new writes happen. The Python approach I used is reproducible: read the raw file, find free pages, parse the record format for the specific database schema, deduplicate.

The AI made this significantly faster than doing it manually. I didn’t need to read the SQLite file format specification or write byte-parsing code from scratch. I described what I needed, the AI wrote the script, I ran it.

If you want to verify whether your own browser history database has recoverable data, you can inspect the free pages with the SQLite command-line tool: sqlite3 History "PRAGMA freelist_count;". A non-zero result means there are free pages that might contain deleted records.

And if you’re clearing history for privacy reasons, follow it with a VACUUM. The browser’s clear history function is not doing what you probably think it’s doing.