DEV Community

Weather Clock Dash
Weather Clock Dash

Posted on

How to Back Up Your Firefox Data (Bookmarks, Passwords, Sessions)

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 extensions folder
  • Sessions — in sessionstore.jsonlz4 (current) and sessionstore-backups/
  • Preferences — in user.js and prefs.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)

  1. Open Bookmarks → Manage Bookmarks (Ctrl+Shift+O)
  2. Import and Backup → Backup...
  3. Saves as a .json file — 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):

  1. Go to about:logins
  2. Three-dot menu → Export Logins
  3. Saves as CSV (store securely — it's plaintext)

Backing Up the Full Profile

The safest backup is a full profile copy:

  1. Close Firefox completely
  2. Navigate to your profile folder (see above)
  3. Copy the entire folder to a backup location

To restore on a new machine:

  1. Install Firefox
  2. Run firefox -ProfileManager to open the Profile Manager
  3. 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', ''))
Enter fullscreen mode Exit fullscreen mode

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:

  1. On old machine: close Firefox, copy entire profile folder
  2. On new machine: install Firefox, open Profile Manager (firefox -ProfileManager)
  3. 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)