When Visual Studio Code starts slowly, displays outdated interface elements, or behaves oddly after an update, clearing its cache can help. VS Code stores temporary files on Windows to speed up startup and rendering, but those files can occasionally become corrupted or out of date. The good news is that you can remove selected cache folders without uninstalling the editor or deleting your projects.
This guide explains how to clear the VS Code cache in Windows, which folders are generally safe to remove, and what to avoid deleting. It also covers PowerShell commands, workspace data, and troubleshooting steps to try if clearing the cache does not solve the problem.
What Does the VS Code Cache Do?
The VS Code cache consists of temporary data used by the editor and its underlying Chromium-based interface. Cached files can help VS Code load faster, display interface resources, and reuse data between sessions. The editor recreates many of these files when needed, so removing selected cache folders is usually a safe troubleshooting step.
However, not everything inside the VS Code data directory is a cache. Settings, keybindings, snippets, extension data, and workspace state may also be stored there. Deleting the wrong folder could reset preferences or remove information you wanted to keep. For that reason, it is better to target specific cache folders rather than erase the entire VS Code data directory.
Where Is the VS Code Cache Stored in Windows?
For a standard VS Code installation, user data is normally stored in this Windows folder:
%APPDATA%\Code
In most cases, %APPDATA% expands to a path like C:\Users\YourName\AppData\Roaming. The main cache folders you may see inside Code include:
-
Cache— cached application and interface data. -
CachedData— cached resources used by VS Code. -
Code Cache— cached code used by the editor’s Chromium-based interface. -
GPUCache— graphics-related cached data. -
CachedExtensions— cached extension package files, where present. -
Service Worker\CacheStorage— cached data used by service workers, where present.
The exact folders can differ between VS Code versions and installations. It is normal if you do not see every folder in this list. VS Code Insiders uses a separate user data directory, commonly %APPDATA%\Code - Insiders. A portable installation may store its data in a data folder next to the VS Code program files instead.
Before You Clear the VS Code Cache
Save your open files and close VS Code completely before removing cache files. If the editor is still running, it may recreate files while you are deleting them, or it may keep some files locked. Closing all VS Code windows is a good first step. If the process remains open, check Task Manager for Code.exe and end it only after saving your work.
You can also make a quick backup of the VS Code data folder if you are unsure what is stored there. In File Explorer, copy %APPDATA%\Code to another location before making changes. This is especially useful if you plan to remove workspace data or troubleshoot a custom configuration.
How to Clear the VS Code Cache Using File Explorer
File Explorer is the simplest way to clear VS Code cache folders on Windows. Follow these steps:
- Save your work and close every VS Code window.
- Press
Windows + Rto open the Run dialog. - Type
%APPDATA%\Codeand press Enter. - Find the cache folders you want to remove, such as
Cache,CachedData,Code Cache, orGPUCache. - Delete the selected folders or their contents. If Windows asks for confirmation, approve the deletion.
- Open VS Code again and allow it to recreate any temporary files it needs.
If a folder is missing, skip it; you do not need to create it. If Windows reports that a file is in use, confirm that VS Code is closed, including any background Code.exe processes, and try again.
Clear VS Code Cache with PowerShell
You can also remove common cache folders with PowerShell. First, close VS Code and save your work. Open PowerShell, then run the following command to stop any remaining VS Code processes:
Get-Process Code -ErrorAction SilentlyContinue | Stop-Process -Force
Next, remove the cache folders that exist in your standard VS Code user data directory:
$cacheFolders = @(
"$env:APPDATA\Code\Cache",
"$env:APPDATA\Code\CachedData",
"$env:APPDATA\Code\Code Cache",
"$env:APPDATA\Code\GPUCache",
"$env:APPDATA\Code\CachedExtensions"
)
foreach ($folder in $cacheFolders) {
if (Test-Path -LiteralPath $folder) {
Remove-Item -LiteralPath $folder -Recurse -Force
}
}
This script checks whether each folder exists before removing it. It targets commonly used cache locations and does not delete your settings folder or installed extensions. Review the paths before running the commands, particularly if you use VS Code Insiders, a portable installation, or a custom user data directory.
For VS Code Insiders, replace $env:APPDATA\Code in the script with $env:APPDATA\Code - Insiders. Because the folder name contains spaces, keep the path inside quotation marks, as shown in the script.
Should You Delete the Entire VS Code Folder?
Usually, no. Deleting the entire %APPDATA%\Code folder can remove much more than temporary cache. It may reset your user settings, keyboard shortcuts, snippets, profiles, extension data, and workspace state. VS Code Settings Sync may restore some synchronized preferences, but it is not a substitute for checking what you are deleting.
Be particularly careful with these folders:
-
User— contains settings, keybindings, snippets, and profile information. -
User\workspaceStorage— stores data associated with individual workspaces and extensions. -
User\globalStorage— stores data used by installed extensions. -
Backups— may contain recovery copies of unsaved files. -
%USERPROFILE%\.vscode\extensions— contains installed extensions, not just disposable cache.
If your goal is simply to clear the VS Code cache, leave these locations alone unless you are deliberately resetting a workspace, extension, or installation. When in doubt, rename a folder temporarily instead of deleting it. You can restore it if the result is not what you expected.
How to Clear VS Code Workspace Cache
If VS Code behaves incorrectly in one particular project but works normally in others, the issue may be related to that workspace’s stored state. Workspace data is commonly kept under:
%APPDATA%\Code\User\workspaceStorage
This folder can contain state associated with previously opened workspaces and extensions. Removing it may resolve some workspace-specific problems, but it can also reset information such as open editors, workspace layout, or extension data for those workspaces. Close VS Code first, and consider backing up the folder before changing it.
For a safer first step, open the affected project and use the Command Palette to run Developer: Reload Window. This restarts the VS Code window without requiring you to remove workspace storage. If you do remove workspace data, avoid deleting the entire folder unless you understand that the change may affect multiple workspaces.
What Happens After You Clear the Cache?
VS Code will rebuild cache files as it runs. The first launch after clearing the cache may take slightly longer because the editor needs to generate some temporary data again. You may also notice a brief delay when opening a project or displaying parts of the interface.
Clearing cache folders should not delete your project files, source code, or Git history because those are normally stored in your project folders, not in the VS Code cache. Still, always save your work and avoid removing directories unless you know what they contain. If you accidentally deleted settings, check whether Settings Sync is enabled or restore the backup you made.
What to Try If Clearing the Cache Does Not Work
A cache reset can help with corrupted temporary data, but it will not fix every VS Code problem. If the same issue continues, try these checks:
- Restart Windows. This can release files held by a background process.
- Update VS Code. Install the latest stable release if the issue may be caused by an older version.
-
Check your extensions. Start VS Code with extensions disabled by running
code --disable-extensionsin Command Prompt or PowerShell. If the problem disappears, re-enable extensions one at a time to find the cause. - Review recent changes. Temporarily undo a recently installed extension or changed setting to see whether it caused the problem.
- Check available disk space. Low storage can interfere with updates and temporary file creation.
- Reinstall VS Code only if needed. Reinstalling the application does not necessarily remove its user data, so it may not clear a problem stored in your profile.
If VS Code is not installed in the usual location or uses a custom data directory, check the shortcut or launch command for options such as --user-data-dir. A custom data path means the cache may be stored somewhere other than %APPDATA%\Code.
Conclusion
To clear the VS Code cache in Windows, close the editor and remove selected temporary folders from %APPDATA%\Code, such as Cache, CachedData, Code Cache, and GPUCache. You can do this with File Explorer or PowerShell, then reopen VS Code so it can rebuild the files.
Avoid deleting the entire VS Code data directory unless you intend to reset your settings, workspace data, or extension information. If the problem affects only one project, try reloading the window or carefully troubleshooting its workspace storage. Targeted cache cleanup is usually the safer and more effective first step.
Disclaimer: Articles are written by Humans, AI or Both. Verify Important information.