Can Chrome browser history be exported to an HTML file?

44

30

In Google Chrome, is there a built-in method to make an HTML file I can save to my local machine, like the file for bookmarks?

If not, is there an extension that does the same?

MountainMan

Posted 2013-05-31T17:39:17.547

Reputation: 594

Bear in mind that today (Feb 2018), and for quite a few months now, Chrome allows you to link a device's data (history, bookmarks, etc), with an account. So, you can sync a google account with a device and then you can access all that information from any other device using that account. I know the question was about exporting it but there is REALLY no need to do that (I was obviously making myself the same question today, which got me here, but then I thought that there should be a better way, this is it). – newbie – 2018-02-28T11:20:23.117

Answers

33

It's even simpler than using an extension: the History page in Chrome is already an HTML page, as are all the other panes and pages in Chrome.

Simply right-click on an empty part of the page, select Save As... and save as full HTML. If you re-open in Chrome, it'd render the same, icons and all. If you try opening the resulting page in a different browser, you'd still get all the history data, just not the styles and icons.

Update May 2016

Since Google constantly changes the way internal pages (history, bookmarks, settings etc.) are rendered, the original answer is no longer accurate. I.e. in Chrome 52 (May 2016) the History URLs appear inside an iframe with a paging mechanism.

For posterity's sake, the best method to get all the bookmarks data (url + date) as a CSV file is described in this article.

TL;DR:

  1. Make sure you have sqlite3 installed in your system. You can use compiled binaries for Windows systems.
  2. Locate the History file (on Mac: cd ~/Library/Application\ Support/Google/Chrome/Default/. On Windows: cd "%LocalAppData%\Google\Chrome\User Data\Default".
  3. Copy the file History to another location (you can't use the original while Chrome is open).
  4. From a command line:
C:\> sqlite3 History
sqlite> .headers on
sqlite> .mode csv
sqlite> .output my-history.csv
sqlite> SELECT datetime(last_visit_time/1000000-11644473600,'unixepoch','localtime'), url FROM urls ORDER BY last_visit_time DESC

You should now have a file called my-history.csv containing all URLs and dates.

Script as a gist can be found here.

Hopefully this works for you in 2016. Can't promise it will in 2019 though :)

Update December 2019

Greetings from the future :)
I can confirm the Sqlite 3 solution is still working in 2019, and actually works with other Chromium-based browsers (recently tested successfully with Brave 1.1.20).

Traveling Tech Guy

Posted 2013-05-31T17:39:17.547

Reputation: 8 743

@TravelingTechGuy, This is a lousy answer which deserves to be deleted. There's literally hundreds of pages of chrome history, this will only "export" the first page. Besides, the format of that export is unusable. There's no way to get a list of URLs one per line. – Pacerier – 2016-05-08T08:00:11.257

@Pacerier Chrome developers change the internal HTML pages (history, bookmarks, settings) almost every build. This answer was correct in 2013. Currently, the actual bookmarks are presented in an iframe, with a paging mechanism. But you can get all the data directly from the History sqlite file - I'll update my answer. At any rate, calling a historical answer lousy is ... well, lousy :) – Traveling Tech Guy – 2016-05-09T05:38:39.300

I am lucky enough to have DBVisualizer, so your query was very helpful to me.

You can copy the History file to your Windows desktop by hitting Win+R and entering cmd /c copy "%USERPROFILE%\AppData\Local\Google\Chrome\User Data\Default\History" %USERPROFILE%\Desktop.

May I edit this answer to make it immediately clear that the first paragraph is no longer valid? Strikeouts perhaps? – Noumenon – 2017-09-23T20:26:18.713

1@Noumenon - done. – Traveling Tech Guy – 2017-09-25T03:47:44.427

1As on Jan 2018 - Chrome 63 - Windows 10, the sqlite method works. it gives following fields - url, title, visit count, last visit time. Two more fields - typed count and hidden do not make sense to me. Use select *, datetime(last_visit_time / 1000000 + (strftime('%s', '1601-01-01T05:30:00')), 'unixepoch') as visit_time from urls to convert last visit time to human readable form. Note that you need to substitute 05:30:00 to your timezone. – matrix – 2018-01-20T22:48:56.497

2018 Jan - I had to ctrl-D in MacOS 10.13.1 sqlite3 in order to actually writeout to a file. – ian5v – 2018-02-12T19:40:24.693

@matrix--you are correct, this is working on Windows 10 with Chrome 64--not sure why it is not working for some folks. – slashp – 2018-03-12T17:59:12.167

See also here a tutorial on Linux, that also applies to other operating systems. And this page on ForensicsWiki for more on the internals.

– tricasse – 2018-05-07T13:42:06.080

2019 here to say it still works! You might want to link to the sqlite download page directly and, for windows, say that you'll want to have to sqldiff.exe, sqlite3.def, sqlite3.dll, sqlite3.exe, & sqlite3_analyzer.exe (prolly don't need that last one) in your PATH Win howto or the Default dir to make things even more brainless. ;^)

– ruffin – 2019-03-18T15:10:27.230

1Sqlite 3 solution works in 2019 :) – burntsugar – 2019-12-15T00:41:57.980

1Can also confirm Sqlite 3 solution works with other Chromium browsers (recently tested successfully with Brave). – Traveling Tech Guy – 2019-12-15T21:49:59.673

God Forbid! Google ever think to make that obvious on the History page as they do with the GUI on the Bookmarks Manager page. Cool. – MountainMan – 2013-05-31T22:30:02.953

2Actually, that doesn't really work, because the history is iframed and paged, so you only get a tiny little bit of your browsing history. – Quandary – 2013-09-07T18:15:49.323

1It worked on Chrome 28 on my Mac. But even if it doesn't work for you, right click in the I frame and choose "save frame source" – Traveling Tech Guy – 2013-09-08T06:03:10.837

3Even if it works, it will only grab the current results, not the whole history. – Synetech – 2013-12-28T21:15:08.163

28

In Mac:

cd "~/Library/Application Support/Google/Chrome/Default"
sqlite3 History "select datetime(last_visit_time/1000000-11644473600,'unixepoch'),url from  urls order by last_visit_time desc" > ~/history_export.txt

In Windows:

cd "%LocalAppData%\Google\Chrome\User Data\Default"
sqlite History "select datetime(last_visit_time/1000000-11644473600,'unixepoch'),url from  urls order by last_visit_time desc" > history_export.txt

This could take a really long time if you are on Windows and do not have SSD.

Antonio

Posted 2013-05-31T17:39:17.547

Reputation: 597

6

A couple of things have changed since this answer http://superuser.com/a/694283/459638 was written (on the mac side of things at least, can't speak for Windows side). 1. sqlite is now (always was?) shipped with OSX so no need to install it. 2. The path for Chrome's app data has changed. Now the command you should use is: cd ~/Library/Application\ Support/Google/Chrome/Default/

– Callum Gare – 2015-06-17T04:45:43.690

I'm on Mac OS 10.10.5 Yosemite and I'm not seeing the sqlite3 file in the location specified. Does anyone know where it is now? – Scott S. – 2015-09-08T15:28:24.310

@ScottS. - cd ~/Library/Application\ Support/Google/Chrome ; find . -name History – Chris Burgess – 2016-07-25T03:06:48.067

'sqlite' is not recognized as an internal or external command, operable program or batch file. – zylstra – 2018-04-01T06:55:55.070

And where does the HTML part come in? – Synetech – 2013-12-28T21:16:03.057

That's a plain text. However it could be useful for Mac users because the previous method works only in Windows – Antonio – 2013-12-28T22:18:09.557

Yes, I know, but the question is about how the Chrome history can be exported to HTML, not plain-text. – Synetech – 2013-12-28T22:20:02.710

15

There is a tool called Chrome History View that exports to several different formats, including HTML. There is a writeup of the tool here.

enter image description here

Brad Patton

Posted 2013-05-31T17:39:17.547

Reputation: 9 939

How do you set the Chrome user-data-dir if you're not using the default? Also, is there an IE version? – Pacerier – 2016-05-25T18:46:26.053

1@Pacerier there is an option to set a specific history file, in [options]--[advanced option] – holly – 2016-08-18T14:47:55.587

@Pacerier BrowserHistoryView, also from Nirsofr, can manage the history of several browsers at once, including IE, Firefox, Chrome and a few others. – GabrielB – 2017-09-25T05:13:44.130

@GabrielB Likewise, newer version of the app (1.41 & newer) already support Microsoft's Chromium-based Edge--just tested & it works perfectly with the Microsoft Chromium Edge Version 80.0.361.9 (dev build). – ikjadoon – 2019-12-24T03:26:35.857

4

I just created a Chrome extension that exports your Chrome history in csv and json called Export History.

You can open the json file in Chrome and view it like a webpage if you install the JSONView extension, and can open the csv file in Excel or Numbers.

cgenco

Posted 2013-05-31T17:39:17.547

Reputation: 164

1I have 2 questions:

  1. Is it paid extension or payment is only an option

  2. Why it requires me to login into google account?

  3. < – yatsek – 2015-01-19T09:09:23.310

>

  • payment is an option for CSV exports; JSON exports are free. 2) the google login is for the Google payment system, which you only need if you upgrade. I should fix that to only require a login if you're upgrading.
  • < – cgenco – 2015-01-20T11:56:40.813

    1The reviews indicate that it is nag-ware and that the dates are off (you need to account for time-zone differences). – Synetech – 2015-12-17T18:03:02.730

    @Synetech I'm still not sure a reliable way to account for time zones because of how Excel handles them, but figuring it out is top on my todo list! – cgenco – 2016-01-21T22:21:37.027

    @cgenco, It still insists on sign-in. Why is signing-in required to tryout the app? – Pacerier – 2016-05-08T08:01:05.650

    @Pacerier Huh, I'm not sure. I think it has to do with how Chrome handles the API access the extension is requesting. I open sourced it here if you'd like to take a look: https://github.com/christiangenco/chrome-export-history

    – cgenco – 2016-05-16T21:02:59.593

    I don't know what I am missing, but this seems exactly like chrom's normal user-sync feature. We login, we ask to view the web store history, we ask what to sync. This has not been updated since 2014, so maybe at the time this was a novel function, but as it stands it seems completely redundant. Chrome History View above is precise, working and does exactly what it should! – chronometric – 2016-05-29T05:51:23.020

    0

    For an indirect solution that might work for people trying to do analytics rather than monitoring, check out rescutime.com. It can show you reports of your browsing history and allows you to export those reports to csv. These may be aggregate reports.

    barrrista

    Posted 2013-05-31T17:39:17.547

    Reputation: 1 519