DEV Community

Weather Clock Dash
Weather Clock Dash

Posted on

How to Recover Lost Tabs in Firefox (And Prevent It Next Time)

How to Recover Lost Tabs in Firefox (And Prevent It Next Time)

If Firefox crashed and you lost a bunch of open tabs, here's how to get them back.


Method 1: Firefox's Built-In Session Restore (Fastest)

Firefox automatically saves your session in the background. After a crash:

  1. Reopen Firefox — it should prompt you to restore your previous session automatically
  2. If it doesn't prompt: go to History → Restore Previous Session (or Ctrl+Shift+H, then find recent history)
  3. If that's greyed out: try Menu (☰) → History → Recently Closed Tabs

Where Firefox stores sessions: %APPDATA%\Mozilla\Firefox\Profiles\[profile]\sessionstore-backups on Windows, ~/.mozilla/firefox/[profile]/sessionstore-backups on Linux, ~/Library/Application Support/Firefox/Profiles/[profile]/sessionstore-backups on macOS.

The sessionstore.jsonlz4 file is the current session. Backup files are named previous.jsonlz4 and recovery.jsonlz4.


Method 2: Recently Closed Tabs List

Even without a crash, Firefox keeps a list of recently closed tabs:

  • Ctrl+Shift+T — reopens the most recently closed tab (press multiple times to step back through history)
  • Menu → History → Recently Closed Tabs — see a list of the last 25 closed tabs
  • about:sessionrestore — view and restore from saved session data directly

Method 3: Browsing History

If the session data is gone:

  1. Ctrl+H or History → Show All History
  2. Sort by "Last Visited"
  3. You can see all pages visited recently, even if the tabs are gone

For sites you visited before the crash, History is the most reliable fallback — session restore can fail if Firefox didn't write the file cleanly before the crash.


Why Firefox Session Restore Fails Sometimes

  1. Sudden power loss — Firefox didn't write the session file before shutdown
  2. Corrupted profile — Rare, but the sessionstore.jsonlz4 file can become unreadable
  3. "Don't restore previous session" preference — about:config → browser.startup.page — if set to 0 or 1 instead of 3, session restore is disabled
  4. Too many tabs — Extreme tab counts can cause session writes to time out

Preventing Tab Loss in the Future

Use Firefox's Session Backup Settings

In about:config, set:

  • browser.sessionstore.interval — how often Firefox saves session data (milliseconds). Default is 15000 (15 seconds). Lower this if you want more frequent saves.
  • browser.sessionstore.max_resumed_crashes — set to -1 to always offer session restore after crashes

Save Named Sessions Manually

The built-in session restore is automatic but can't be manually controlled. For tabs you know you'll want later, Tab Manager & Session Saver lets you save a named snapshot of all open tabs with one click.

The difference from bookmarking: it captures the exact set of tabs in the current state as a group you can restore in one shot, rather than individual bookmarks you'd have to open one at a time.

Useful for:

  • Saving a research session before closing your laptop
  • Separating "work project" tabs from "other tabs" by saving each context as a named session
  • Recovery — if you save sessions regularly, you have a fallback that doesn't depend on Firefox's crash recovery

The sessionstore.jsonlz4 File Directly

If Firefox won't restore, you can read the session file yourself:

# Linux/Mac — decompress the lz4 session file
python3 -c "
import sys, struct
f = open(sys.argv[1], 'rb')
magic = f.read(8)  # mozLz40 + null byte header (8 bytes total)
import lz4.block
data = lz4.block.decompress(f.read(), uncompressed_size=10000000)
print(data.decode()[:5000])
" ~/.mozilla/firefox/*/sessionstore-backups/recovery.jsonlz4
Enter fullscreen mode Exit fullscreen mode

This outputs a JSON blob with all your tabs, windows, and their URLs — useful if you need to manually extract specific URLs from the crash state.


Quick Reference

Situation Solution
Just crashed History → Restore Previous Session
Closed wrong tab Ctrl+Shift+T
Session restore greyed out History → Recently Closed Tabs
All else fails Ctrl+H → History, sort by recent
Prevent future loss Tab Manager extension, save sessions before closing

Top comments (0)