Firefox bookmarks


 * For .jsonlz4, see Mozilla LZ4.

Firefox bookmarks originally used the HTML-based Netscape bookmarks format, as did the Mozilla/Seamonkey Suite. However, as of Firefox 3.0, a new format was used based on SQLite with write-ahead logging. The bookmarks are also regularly automatically backed up in the JSON format.

The relevant files are places.sqlite and places.sqlite-wal in the user profile directory (system-specific; in Windows, at least from Vista through 10, it is \Users\username\AppData\Roaming\Mozilla\Firefox\Profiles\cryptic-profile-ID). This directory structure may be hidden depending on your operating system configuration. A subdirectory of this called bookmarkbackups has the backups, with filenames like bookmarks-2012-10-28.json which contain the date of the backup.

Other things including site visit history are also stored in the places.sqlite database.

The data structure in the SQLite file is given in the embedded SQL commands:

CREATE TABLE moz_bookmarks (id INTEGER PRIMARY KEY,type INTEGER, fk INTEGER DEFAULT NULL, parent INTEGER, position INTEGER, title LONGVARCHAR, keyword_id INTEGER, folder_type TEXT, dateAdded INTEGER, lastModified INTEGER, guid TEXT)

CREATE TABLE moz_bookmarks_roots (root_name VARCHAR(16) UNIQUE, folder_id INTEGER)

CREATE TABLE moz_keywords (id INTEGER PRIMARY KEY AUTOINCREMENT, keyword TEXT UNIQUE)

CREATE TABLE sqlite_sequence(name,seq)

CREATE TABLE moz_favicons (id INTEGER PRIMARY KEY, url LONGVARCHAR UNIQUE, data BLOB, mime_type VARCHAR(32), expiration LONG, guid TEXT)

CREATE TABLE moz_annos (id INTEGER PRIMARY KEY,place_id INTEGER NOT NULL,anno_attribute_id INTEGER,mime_type VARCHAR(32) DEFAULT NULL,content LONGVARCHAR, flags INTEGER DEFAULT 0,expiration INTEGER DEFAULT 0,type INTEGER DEFAULT 0,dateAdded INTEGER DEFAULT 0,lastModified INTEGER DEFAULT 0)

CREATE TABLE moz_anno_attributes (id INTEGER PRIMARY KEY,name VARCHAR(32) UNIQUE NOT NULL)

CREATE TABLE moz_items_annos (id INTEGER PRIMARY KEY,item_id INTEGER NOT NULL,anno_attribute_id INTEGER,mime_type VARCHAR(32) DEFAULT NULL,content LONGVARCHAR, flags INTEGER DEFAULT 0,expiration INTEGER DEFAULT 0,type INTEGER DEFAULT 0,dateAdded INTEGER DEFAULT 0,lastModified INTEGER DEFAULT 0)

CREATE TABLE moz_places (id INTEGER PRIMARY KEY, url LONGVARCHAR, title LONGVARCHAR, rev_host LONGVARCHAR, visit_count INTEGER DEFAULT 0, hidden INTEGER DEFAULT 0 NOT NULL, typed INTEGER DEFAULT 0 NOT NULL, favicon_id INTEGER, frecency INTEGER DEFAULT -1 NOT NULL, last_visit_date INTEGER, guid TEXT)

CREATE TABLE moz_historyvisits (id INTEGER PRIMARY KEY, from_visit INTEGER, place_id INTEGER, visit_date INTEGER, visit_type INTEGER, session INTEGER)

CREATE TABLE moz_inputhistory (place_id INTEGER NOT NULL, input LONGVARCHAR NOT NULL, use_count INTEGER, PRIMARY KEY (place_id, input))

CREATE TABLE sqlite_stat1(tbl,idx,stat)

CREATE TABLE moz_hosts ( id INTEGER PRIMARY KEY, host TEXT NOT NULL UNIQUE, frecency INTEGER, typed NOT NULL DEFAULT 0, prefix)

Links

 * Import bookmarks from an HTML file
 * Backing up and restoring bookmarks
 * Mozillazine knowledge base: places.sqlite
 * Mozilla bug list related to places.sqlite