whatfileis.pro
Paste a filename and find out what it is, whether it is safe, and what opens it.

Recover Unsaved VS Code Files

VS Code keeps unsaved edits in a hidden Backups folder, so a closed tab or a crash usually hasn't lost your work. First try reopening VS Code — it restores the last session automatically. If not, the raw text is in %appdata%\Code\Backups. Steps below.

Category
Safe to delete?
Opens with

First: reopen VS Code

VS Code restores your previous session by default — unsaved tabs reappear with their content. If they don't, don't open or edit anything yet; go straight to the backup folder.

Find the backup files

  • Windows: %appdata%\Code\Backups
  • macOS: ~/Library/Application Support/Code/Backups
  • Linux: ~/.config/Code/Backups

Inside Backups you'll find folders named with a hash per workspace. Open workspaces.json in that folder to match a hash to your project path. The backup files inside hold your unsaved text as plain content — open them in any editor and copy it out.

Restore cleanly

  1. Copy the recovered text into a new file and save it under a real name before editing further.
  2. If you use the Insiders build, the path is Code - Insiders instead of Code.
  3. Enable Hot Exit (Settings → search files.hotExit, set to onExitAndWindowClose) so VS Code always keeps unsaved state next time.

FAQ

Where does VS Code store unsaved files?

In a hidden Backups folder: %appdata%\Code\Backups on Windows, ~/Library/Application Support/Code/Backups on macOS, or ~/.config/Code/Backups on Linux. Each workspace gets a hashed subfolder holding the raw unsaved text.

I closed VS Code without saving — is my work gone?

Usually not. Reopen VS Code; it restores the last session with unsaved tabs. If that fails, open the Backups folder above and copy your text out of the backup file before doing anything else.

How do I match a backup folder to my project?

Open workspaces.json inside the Backups folder — it lists each workspace's directory path next to its hash, so you can find the subfolder that belongs to your project.

How do I stop losing unsaved VS Code work in future?

Enable Hot Exit: open Settings, search files.hotExit, and set it to onExitAndWindowClose. VS Code will then always preserve unsaved editors when you close it.

Other file types explained