Visual Studio Code can occasionally slow down, display stale content, or behave unexpectedly because of temporary files left behind by the editor or its extensions. Clearing the relevant cache can help resolve these issues without removing your projects or settings—provided you delete only cache data, not the entire VS Code user-data folder.
To clear the VS Code cache, close the application, locate its user-data directory, and remove the cache folders inside it. The exact location depends on your operating system and installation. The steps below explain what to remove, what to keep, and what to try if the problem persists.
What Does the VS Code Cache Do?
VS Code stores temporary files to speed up startup, load editor resources, and support features such as webviews and graphics rendering. Depending on your version and operating system, these files may be stored in folders named Cache, Code Cache, GPUCache, or CachedData.
Cache files are generally safe to delete while VS Code is closed. The editor will recreate the files it needs the next time it starts. The first launch after clearing the cache may take a little longer as VS Code rebuilds temporary data.
Not everything inside the VS Code user-data directory is a cache. Settings, keyboard shortcuts, profiles, extension data, and workspace state may also be stored there. Deleting the whole directory can reset your setup or remove data you meant to keep, so target only the cache folders.
Before You Clear the VS Code Cache
Save your work and close every VS Code window before deleting cache files. If the application is still running, it may recreate files as you remove them, or keep some files locked.
If you are unsure whether you have found the right directory, make a backup of the relevant folders first. You can also check whether you use a standard, Insiders, portable, or package-managed installation, since each may store its data in a different location.
- Save open files and close all VS Code windows.
- Check that the VS Code process has fully exited.
- Delete cache folders only; do not delete the entire user-data folder.
- Keep a backup if you are uncertain about a folder’s contents.
How to Clear the VS Code Cache on Windows
For a standard VS Code installation, the user-data directory is usually %APPDATA%\Code. To open it, press Windows key + R, enter %APPDATA%\Code, and press Enter. You can also paste that path into the File Explorer address bar.
Inside the directory, look for cache folders such as Cache, Code Cache, GPUCache, and CachedData. Folder names can differ by VS Code version, so you may not see every item. Delete the folders that are clearly cache-related, then empty the Recycle Bin if you want to reclaim the space immediately.
Do not delete the whole Code folder. In particular, avoid removing the User folder, which can contain settings and keybindings, or globalStorage, which may contain data saved by extensions. The workspaceStorage folder can also hold workspace-specific state, so it is not a general-purpose cache to clear as a first step.
If you use VS Code Insiders, its user-data directory is typically %APPDATA%\Code - Insiders. Clear cache folders there rather than in the standard VS Code directory.
How to Clear the VS Code Cache on macOS
On macOS, the standard user-data directory is usually ~/Library/Application Support/Code. In Finder, choose Go > Go to Folder, enter that path, and press Enter. The Library folder is hidden in many Finder views, so using Go to Folder is often the easiest way to reach it.
With VS Code closed, remove cache-related folders such as Cache, Code Cache, GPUCache, or CachedData, if present. Leave settings, extension data, and workspace state alone unless you specifically intend to reset them. Open VS Code again after removing the selected folders.
For VS Code Insiders, check ~/Library/Application Support/Code - Insiders. If you installed VS Code in portable mode or use a custom user-data directory, its cache may be somewhere else.
How to Clear the VS Code Cache on Linux
For many standard Linux installations, the user-data directory is ~/.config/Code. Open your file manager and enable hidden files, or navigate to that path in a terminal or file picker. Close VS Code, then remove cache folders such as Cache, Code Cache, GPUCache, and CachedData if they exist.
VS Code Insiders commonly stores its data in ~/.config/Code - Insiders. Package formats such as Snap and Flatpak may use different locations. For example, a Snap installation may keep data under your home directory’s snap folder, while Flatpak applications use an application-specific directory under ~/.var/app. If the standard path is missing, check your package’s documentation or search for the active VS Code user-data directory before deleting anything.
Some Linux setups also use a separate cache location under ~/.cache. If you find a VS Code-specific cache there, it may be safe to remove while the application is closed. Do not delete a general cache directory or an unfamiliar folder simply because its name contains “cache.”
Clear Cache Using the Terminal
You can remove known cache folders from a terminal, but first confirm the path for your installation. The commands below are examples for standard installations. They remove only the named folders and may report an error if a folder does not exist.
- Windows PowerShell: Remove-Item -Recurse -Force "$env:APPDATA\Code\Cache", "$env:APPDATA\Code\Code Cache", "$env:APPDATA\Code\GPUCache"
-
macOS:
rm -rf "$HOME/Library/Application Support/Code/Cache" "$HOME/Library/Application Support/Code/Code Cache" "$HOME/Library/Application Support/Code/GPUCache" -
Linux:
rm -rf "$HOME/.config/Code/Cache" "$HOME/.config/Code/Code Cache" "$HOME/.config/Code/GPUCache"
Use terminal deletion commands carefully: rm -rf and PowerShell’s Remove-Item -Recurse -Force can permanently delete files without asking for confirmation. Do not run a command if you have not checked the directory and each path it targets. Add CachedData only if you have confirmed it is inside the correct VS Code user-data directory and you want to clear that cache too.
What If You Use Portable Mode or a Custom Data Directory?
In portable mode, VS Code stores user data alongside the application instead of using the usual operating-system location. Look for a data directory in the VS Code installation folder. Its cache may be inside that directory, often under a user-data subfolder. Clear cache folders there, not the entire portable data directory.
You or an administrator may also have launched VS Code with a custom --user-data-dir path. In that case, the custom directory—not the standard location—contains the relevant user data. If you are unsure which setup you have, check your shortcut, launch script, or application configuration before proceeding.
Cache Folders You Should Not Delete Casually
Deleting cache is different from resetting VS Code. To avoid losing useful information, do not remove the entire user-data directory just to address a slow editor or display glitch.
-
Usercan contain settings, keybindings, snippets, and profile information. -
globalStoragecan contain information saved by extensions. -
workspaceStoragecan contain workspace-specific state. -
.vscode/extensionscontains installed extensions, not ordinary temporary cache files.
If you intend to reset one of these areas, back it up first and understand what it stores. For a simple cache cleanup, leave these folders in place.
What to Do If Clearing the Cache Does Not Help
Cache problems are only one possible cause of VS Code issues. If the same problem returns, try restarting your computer, updating VS Code, or checking whether a particular extension is responsible. You can start VS Code with extensions disabled using the --disable-extensions option; if the issue disappears, re-enable extensions one at a time to identify the cause.
You can also open the Command Palette and run Developer: Reload Window to reload the current VS Code window. This is a quick troubleshooting step, but it is not the same as deleting cache files. If the problem involves a specific workspace, test with a different project before removing workspace data.
For persistent errors, review the output in View > Output or check the relevant extension’s documentation. Avoid deleting additional folders at random: doing so can remove configuration or extension data without solving the underlying issue.
Conclusion
To clear the VS Code cache, close the editor, open its user-data directory for your operating system, and delete only clearly identified cache folders such as Cache, Code Cache, or GPUCache. The locations differ across Windows, macOS, Linux, Insiders, and portable installations, so verify the correct directory before making changes.
Keep settings, extension storage, workspace state, and the rest of the user-data folder intact unless you are deliberately resetting them. Once you reopen VS Code, it will rebuild the cache it needs. If the issue continues, investigate extensions, updates, and workspace-specific problems rather than removing more data indiscriminately.
Disclaimer: Articles are written by Humans, AI or Both. Verify Important information.