Recover Unsaved Sublime Text Files
Sublime Text autosaves your session (including unsaved tabs) every few seconds, so a crash rarely loses your work. Reopening Sublime usually restores everything. If it doesn't, your text is inside Session.sublime_session. Steps below.
First: just reopen Sublime
Sublime restores open tabs and unsaved buffers on launch. If your text doesn't come back, close Sublime again before anything overwrites the session, then go to the session file.
Find the session file
- Windows:
%APPDATA%\Sublime Text\Local\Session.sublime_session(older builds:Sublime Text 3\Local\) - macOS:
~/Library/Application Support/Sublime Text/Local/ - Linux:
~/.config/sublime-text/Local/
Open Session.sublime_session in another editor — it's JSON. Search for "buffers" and your unsaved text is stored there as "contents". Copy it out.
If the session is corrupted
- Look for
Session.sublime_session-backupin the same folder — Sublime keeps a backup against corruption. - Copy recovered text into a new file and save it properly.
- Keep hot_exit enabled (default) so unsaved buffers are always preserved between launches.
FAQ
Where does Sublime Text keep unsaved files after a crash?
In Session.sublime_session. On Windows that's %APPDATA%\Sublime Text\Local\, on macOS ~/Library/Application Support/Sublime Text/Local/, on Linux ~/.config/sublime-text/Local/. It's a JSON file — your unsaved text is under the 'buffers' → 'contents' keys.
Sublime didn't restore my tabs — can I still get my work?
Yes. Close Sublime so nothing overwrites the session, then open Session.sublime_session in another editor and search for 'contents' to find and copy your unsaved text. If it's corrupted, try Session.sublime_session-backup in the same folder.
Does Sublime autosave unsaved files automatically?
Yes — it writes session state (including unsaved buffers) every ~30 seconds and uses hot_exit to keep them between launches, so a crash usually loses only the last few seconds.
How do I open the .sublime_session file?
It's plain JSON text — open it in any text editor (even Notepad). Don't open it in the same Sublime instance you're recovering, or you risk overwriting it; use a different editor.
Other file types explained
- What Is a .~lock File? (LibreOffice Lock File)
- What Is a ~$ File? (Word & Excel Owner File)
- What Is a File Ending in ~ (Tilde)? Editor Backup File
- Recover an Unsaved Notepad++ File After a Crash
- How to Recover Data from .CHK Files (FOUND.000)
- How to Recover an Excel Workbook from a .XLK Backup
- How to Recover an Unsaved Word Document (.asd AutoRecover)
- How to Recover Unsaved Changes from a Vim .swp File