How to Fix VS Code High CPU Usage
Visual Studio Code is a highly popular and lightweight text editor, but users occasionally encounter performance issues where the application consumes an unusually high percentage of CPU resources. This guide provides a direct, step-by-step troubleshooting workflow to help you identify the root cause of the slowdown and implement effective solutions. You will learn how to use built-in diagnostics, isolate problematic extensions, and adjust specific settings to restore VS Code to its optimal, lightweight state.
Step 1: Identify the Culprit with Process Explorer
VS Code has a built-in task manager called the Process Explorer. This tool shows exactly which process (such as a utility process, the main window, or a specific extension) is consuming your CPU.
- Open VS Code.
- Click on Help in the top menu bar, then select
Open Process Explorer (or press
Ctrl+Alt+P/Cmd+Option+Pon some systems). - Look at the CPU % column to find the process with the high percentage.
- If the high CPU usage is tied to an extension host or a specific extension process, you have found the source. If it is tied to a file-watching or search process, your project configuration may need adjustment.
Step 2: Test Without Extensions
Extensions are the most common cause of high CPU usage in VS Code. To verify if an extension is causing the issue, you should run VS Code with all extensions temporarily disabled.
Close all running instances of VS Code.
Open your terminal or command prompt.
Launch VS Code from the command line using the following command:
code --disable-extensionsWork in this clean environment for a few minutes. If the CPU usage returns to normal, an extension is definitely causing the issue.
To find the specific problematic extension, re-enable your extensions one by one (or in halves) until the high CPU usage returns, then uninstall or replace that extension.
Step 3: Optimize File Watcher and Search Settings
VS Code constantly monitors files in your workspace for changes. If
you are working on a large project with thousands of files (like a
massive node_modules folder or build directories), the file
watcher can overload your CPU.
You can exclude heavy folders from being indexed by updating your settings:
- Open Settings (
Ctrl+,orCmd+,). - Search for
watcher exclude. - Under Files: Watcher Exclude, add patterns for
directories you do not need to track. For example:
**/node_modules/***/dist/***/.git/*
- Search for
search excludeand ensure similar heavy folders are added to Search: Exclude to prevent the search indexer from constantly scanning them.
Step 4: Disable GPU Acceleration
In some systems, hardware compatibility issues with the Chromium engine underneath VS Code can cause severe CPU spikes. Disabling GPU acceleration can resolve this.
Open the Command Palette (
Ctrl+Shift+PorCmd+Shift+P).Type and select Preferences: Configure Runtime Arguments. This opens the
argv.jsonfile.Add the following line to the JSON configuration:
"disable-hardware-acceleration": trueSave the file, close VS Code, and restart your computer.
Step 5: Clear VS Code Cache
Corrupted cache files can cause the editor to get stuck in infinite loops, leading to high CPU usage.
- Close VS Code.
- Navigate to the cache directory on your operating system:
- Windows:
%APPDATA%\Code\Cacheand%APPDATA%\Code\CachedData - macOS:
~/Library/Application Support/Code/Cacheand~/Library/Application Support/Code/CachedData - Linux:
~/.config/Code/Cacheand~/.config/Code/CachedData
- Windows:
- Delete the contents of these folders and restart VS Code.