Firefox stores a surprising amount of data locally. Here's what it is, where it lives, and how to back it up or migrate it to a new machine.
What Firefox Stores Locally
- Profile folder — the main container for all your Firefox data
-
Bookmarks — in a SQLite database (
places.sqlite) -
History — also in
places.sqlite -
Passwords — in
logins.json+key4.db(encrypted) -
Cookies — in
cookies.sqlite -
Extensions — in the
extensionsfolder -
Sessions — in
sessionstore.jsonlz4(current) andsessionstore-backups/ -
Preferences — in
user.jsandprefs.js
Finding Your Profile Folder
Go to about:support → "Profile Folder" → click "Open Folder."
Or navigate directly:
-
Linux:
~/.mozilla/firefox/PROFILE_ID.default-release/ -
macOS:
~/Library/Application Support/Firefox/Profiles/PROFILE_ID.default-release/ -
Windows:
%APPDATA%\Mozilla\Firefox\Profiles\PROFILE_ID.default-release\
There's usually one profile folder. If you have multiple, about:support shows which one is current.
Backing Up Bookmarks
Method 1: HTML Export (portable, importable anywhere)
- Open Bookmarks → Manage Bookmarks (Ctrl+Shift+O)
- Import and Backup → Backup...
- Saves as a
.jsonfile — Firefox's native format
Or: Export Bookmarks to HTML — creates an HTML file importable into any browser.
Method 2: Copy places.sqlite
Close Firefox first. Copy places.sqlite from your profile folder. This contains both bookmarks and history in one file.
Note: This file format can change between Firefox versions. The HTML/JSON export is safer for long-term portability.
Backing Up Passwords
Firefox passwords are stored encrypted in:
-
logins.json— the encrypted password data -
key4.db— the encryption key (derived from your Firefox primary password, or default key if none)
To back up properly, you need both files. Copy them together. Restoring them works by copying both to the same profile location.
Export to CSV (readable but unencrypted):
- Go to about:logins
- Three-dot menu → Export Logins
- Saves as CSV (store securely — it's plaintext)
Backing Up the Full Profile
The safest backup is a full profile copy:
- Close Firefox completely
- Navigate to your profile folder (see above)
- Copy the entire folder to a backup location
To restore on a new machine:
- Install Firefox
- Run
firefox -ProfileManagerto open the Profile Manager - Create a new profile, point it to your copied folder
Session Backup
Firefox's current session is stored in sessionstore.jsonlz4. This is a compressed JSON file. If Firefox crashes, it uses sessionstore-backups/recovery.jsonlz4.
The .jsonlz4 format is a Mozilla-specific format (LZ4 compression with a magic header). To read it:
import lz4.block
import json
# Read the mozlz4 file
with open('sessionstore.jsonlz4', 'rb') as f:
magic = f.read(8) # "mozLz40" + null byte (8 bytes total)
data = f.read()
decompressed = lz4.block.decompress(data)
session = json.loads(decompressed)
# Extract URLs from all tabs
for window in session.get('windows', []):
for tab in window.get('tabs', []):
entries = tab.get('entries', [])
if entries:
print(entries[-1].get('url', ''))
This is useful for extracting URLs from a session file for archival or analysis.
For Named Session Management
Firefox's session backup covers the current session. It doesn't let you save named snapshots or restore a specific past session by name.
Tab Manager & Session Saver adds this: save named snapshots of your current tabs (e.g., "project research," "reading queue"), then restore them independently of your current tabs. The sessions are stored as readable JSON in extension storage.
Combination that works well:
- Firefox's built-in session restore handles crashes and automatic continuity
- Tab Manager handles explicit named snapshots for intentional saves
Migrating to a New Machine
For a full migration:
- On old machine: close Firefox, copy entire profile folder
- On new machine: install Firefox, open Profile Manager (
firefox -ProfileManager) - Create profile pointing to copied folder, or use "Import Data" from about:preferences
If you use Firefox Sync, the simpler approach: install Firefox on new machine, sign into the same Firefox Account, let it sync. Passwords, bookmarks, and history will transfer. Extensions list syncs but not all extension settings.
The profile copy method transfers more (cookies, extension data, custom settings) but requires manual work.
Top comments (0)