MozillaZine

Backing up and restoring bookmarks - Firefox

From MozillaZine Knowledge Base

This article explains how to create and restore bookmark backup files in JSON format, as well as how to import and export bookmarks in HTML format, in Firefox 3.0 and above.

Contents

Library window

The Firefox Library window (shown below on Windows) is where you can organize your bookmarks, manually create a bookmark backup, restore your bookmarks from backup, and import or export bookmarks in HTML format. The Library window is opened from the Bookmarks menu, by clicking "Show all Bookmarks".

Note: The instructions given below require using the Firefox Library window "Import and Backup" button, which does not include a text label on Mac OS.

Difference between restoring and importing bookmarks

When you restore a bookmark backup file, it replaces your existing bookmarks with the contents of the backup file. This will remove your existing bookmarks. Starting in Firefox 3, Firefox includes a bookmark Backup and bookmark Restore feature, in addition to the export bookmarks and import bookmarks features found in all Mozilla browsers. All bookmark backup files created and used in Firefox 3.0 and above are in JSON format. The backup file can be one of the bookmark backups that Firefox creates automatically or it can be a backup file you've created yourself.

When you import a bookmarks HTML file, its contents are added to your existing bookmarks. If you want to add bookmarks from another Firefox installation to your existing bookmarks, you must first have a bookmarks HTML file. (You can create a bookmarks HTML file by exporting your bookmarks.) You would then use the Firefox Library window's Import HTML feature (not the "Restore" feature). The file you import must be in HTML format. Similarly, if you want to add bookmarks from Firefox 2 or another browser into Firefox or if you want to move your Firefox bookmarks to another browser, you must use the Import HTML and Export HTML features.

Creating bookmark backups

Firefox automatically creates daily rotating backups of your bookmarks. The most recent bookmark backup files are stored in the bookmarkbackups folder, located in the Firefox profile folder. You can also create your own bookmark backups, by opening the Library window, clicking the "Import and Backup" button (button with a star icon on Mac OS) and selecting "Backup...". The Backup feature allows you to save a bookmark backup file (e.g., "bookmarks-2010-12-03.json") to the location of your choice. Bookmark backup files are stored in JSON format and can be restored from the Library window of any Firefox installation, as shown below.

Restoring bookmarks from backup

Firefox Library window (shown on Windows XP)

You can replace your current bookmarks with a backup from the Firefox Library window (see above). Click the "Import and Backup" button (shown here on Windows) or the button with a star icon (on Mac OS) and then select the "Restore" option. You can select one of the dated backups that Firefox automatically creates or you can use the "Choose File..." option to select another bookmark backup, such as a backup you created yourself or one from the bookmarkbackups folder of another profile (see Profile folder - Firefox for profile location).

If you see the error, Unable to process the backup file, read Unable to process the backup file - Firefox.

If you choose to restore your own bookmark backup file, it must be in JSON format. Any bookmarks saved in HTML format, such as exported bookmarks, must be imported (see below). [1]

Import and Export

Firefox and many other browsers allow you to import bookmarks from an HTML file and export bookmarks to an HTML file. Starting in Firefox 3, this is done from the Library window using "Import HTML" and "Export HTML" in the "Import and Backup" menu.

Import HTML

Note: You may need to set your operating system to show files in hidden locations, if you want to import a bookmarks HTML file from another profile. On Windows, also make sure that file extensions are not hidden. See Show hidden files and folders for details.

To import a bookmarks HTML file, open the Firefox Library window, click the "Import and Backup" or star button and select "Import HTML... -> from an HTML File". When the file picker appears, navigate to the folder that contains the bookmarks HTML file you wish to use and select that file.

The "Import HTML" feature of the Library window will add the entire contents and folder structure of any bookmarks file in HTML format to the end of your current "Bookmarks Menu". This would normally result in the imported "Bookmarks Toolbar", "Bookmarks Menu" and "Unsorted Bookmarks" within the imported HTML to be dumped at the end of your current "Bookmarks Menu". It would be wise to place some bookmark separators at the bottom of the "Bookmarks Menu" before importing so you can find your additions and so that any later sorting of bookmarks will not co-mingle the added folders. After importing, you will have to move the imported bookmarks and folders around to where you actually want them.

Make sure you have turned off automatic sorting if you are using the SortPlaces extension, and that you will not be automatically deleting duplicates with any other extensions.

If you don't wish to keep your current bookmarks, start Firefox in Safe Mode, select the option, "Delete all bookmarks except for backups", and choose "Make Changes and Restart", before importing the bookmarks HTML file.

Only files in HTML format can be imported. To replace your current bookmarks with a bookmark backup file stored in JSON format, you should use the "Import and Backup -> Restore" feature (see above).

Export HTML

You can also export your bookmarks to an HTML file by opening the Library window, clicking the "Import and Backup" button and selecting "Export HTML...". Name the file (bookmarks.html is the default) and select a location to save the HTML file.