Why export browsing history?
Most people never need a raw dump of where they have been on the web. When the need does come up, it is usually tied to a specific job: you might want to analyze patterns (which domains show up most often, or how research spread across weeks), keep an offline backup before erasing a user account or selling a Mac, or preserve a paper trail for record keeping when documentation matters.
Others are switching browsers or tools: a CSV becomes a portable list of URLs and titles you can reconcile manually or import into a bookmark manager, a wiki, or a second browser’s import workflow. Freelancers and students sometimes export history to pair with invoices or bibliographies — not because every URL belongs in a report, but because the right subset is faster to find in a spreadsheet than by scrolling Safari’s list.
Comma-separated values are the lingua franca of that kind of work. Numbers, Excel, and Google Sheets all open CSV files cleanly; you can also grep or script them. That is why “Safari history spreadsheet” is such a frequent search: the grid is where people already do their thinking.
Does Safari export history by itself?
Safari on Mac makes it easy to revisit where you have been through the History menu, the sidebar, and search within that UI. What it does not offer is a menu item to download or export that same data as a file. Plenty of users wish it did — especially anyone who lives in spreadsheets — and that gap is normal for browsers that optimize for day-to-day navigation rather than data portability.
The rest of this guide covers how to get a Safari history CSV anyway: first the technical path straight from Apple’s database, then a simpler option if you would rather not touch SQL.
Manual method: History.db and sqlite3
On macOS, Safari persists browsing history in a SQLite database file at:
~/Library/Safari/History.db
The tilde means your home folder; Library is hidden by default in Finder, but Terminal and “Go to Folder…” (⇧⌘G) can reach it. Apple can change internal storage over time, but on current macOS versions this path remains the standard place to find the main history store.
macOS includes sqlite3, a command-line client for SQLite. With it you can list tables, inspect columns, and run SELECT queries. The schema is oriented around history_items (one row per distinct URL with title and aggregate visit count) and history_visits (rows for individual visits, including time). That is enough to build your own export — if you are comfortable in Terminal and willing to handle a few rough edges.
- Database lock: Safari keeps the database open while it runs. Attempts to read or copy in place sometimes fail with “database is locked.” The reliable fixes are to quit Safari before querying, or to copy
History.db(and its-shm/-walsidecar files if present) to another directory and runsqlite3against the copy while Safari stays open. - Technical comfort: You will need basic SQL, path literacy, and patience with Apple’s timestamp formats. Visit times are stored in a form tied to Apple’s reference date; turning them into human-readable dates in a sheet often means a formula or a more advanced query than the starter example below.
- Permissions and privacy: You are reading your own user data on your own Mac. Still, exported CSVs can contain sensitive URLs — treat the output like any other personal archive.
- iCloud Safari: Synced history ultimately lands in local databases per device. For a one-off export, working from the Mac where you browse is usually enough; if something looks incomplete, check that iCloud has finished syncing and consider exporting from the device you use most.
Below is a practical recipe that writes a UTF-8 CSV to your Desktop. Use it after quitting Safari or after copying the database elsewhere and adjusting the path. It enables column headers, switches SQLite to CSV mode, sends output to a file, and selects title, URL, and visit count from history_items:
sqlite3 ~/Library/Safari/History.db <<'SQL' .headers on .mode csv .output ~/Desktop/safari_history.csv SELECT title, url, visit_count FROM history_items; .quit SQL
To see which tables exist on your Mac’s copy of the file (useful after a major macOS upgrade):
sqlite3 ~/Library/Safari/History.db ".tables"
For per-visit rows with timestamps, join history_visits to history_items — typically matching history_visits.history_item to history_items.id. Column names can shift slightly between releases, so inspect them first:
sqlite3 ~/Library/Safari/History.db "PRAGMA table_info(history_visits);"
This manual route is powerful and free, and it is the authentic answer to “how do I download Safari browsing history as data?” It is also the sort of task you might do once a year — which is exactly when a simpler tool pays off.
Retraced: CSV without the terminal
Retraced is a Safari extension focused on full-text search across the pages you visit: titles, URLs, and indexed page content, all stored locally on your Mac. Alongside search, it is designed for the same spreadsheet use case described above: you can export Safari history as CSV in one step, or copy to the clipboard and paste straight into Numbers, Excel, or Google Sheets.
You avoid quitting Safari for the export, writing SQL, and hunting down timestamp conversion — the extension presents the export in a form meant for everyday workflows rather than database administration. If your goal is a clean Safari history spreadsheet for filtering and sharing (with the usual caution about sensitive links), that friction matters.
What’s in the CSV?
Whether you build the file yourself from History.db or use Retraced, a good export should answer the obvious questions: what page, where, how often, and when. Retraced’s CSV is organized around those needs: page titles, full URLs, domains, visit counts, and timestamps, so you can sort chronologically, pivot by site, or filter to a date range.
Open the file in Apple Numbers, Microsoft Excel, or Google Sheets via File → Import, or double-click if your default app is already a spreadsheet. If you used “copy to clipboard,” paste into cell A1 of a new sheet; most apps detect tab- or comma-separated data. Anything that edits plain text — VS Code, BBEdit, or TextEdit — can open the same file if you only need to search or trim rows.
Try the beta
Retraced keeps its indexed data in Safari’s extension storage and does not replace Apple’s own history database — but it gives you fast search and export on top of the browsing you do after you install it. If you want both deep search and a one-click path to CSV, the TestFlight beta is the place to start.