Debugging in VS Code means running your code under a debugger that can pause execution, let you inspect variables, and step through code one line at a time. The Run and Debug view is where you start and control every debug session.
This guide walks you through your first debug session from start to finish. You do not need a special project. A single JavaScript or Python file is enough to follow along.
Open the Run and Debug view
The Run and Debug view is the vertical panel on the left side of VS Code, accessed from the Activity Bar. Click the icon that looks like a play button with a bug (or press Ctrl+Shift+D on Windows/Linux, Cmd+Shift+D on macOS).
When no debug session is running, the view shows a Run and Debug button and a dropdown to pick a launch configuration. If you have never debugged in this workspace before, the dropdown is empty and the button says Run and Debug.
The view has these sections, visible once a session starts:
- VARIABLES: Shows local and global variables with their current values.
- WATCH: Lets you type expressions and watch their values change as you step through code.
- CALL STACK: Shows the chain of function calls that led to the current paused line.
- BREAKPOINTS: Lists every breakpoint you have set across all files.
You can collapse or expand each section. During a debug session, these sections populate automatically.
Start your first debug session
Open the file you want to debug. Make sure it is the active editor tab. Press F5.
VS Code shows a dropdown asking you to pick a debugger. For JavaScript or TypeScript, choose Node.js. For Python, choose Python Debugger. Pick the matching debugger extension for other languages.
After you select the debugger, VS Code starts the session. The Status Bar changes color (orange in most themes) to show that a debug session is active. The Debug Console panel opens at the bottom and displays any output from your program.
If your program runs and exits immediately, that is normal. You have not set any breakpoints yet, so the debugger ran straight through to the end. The orange Status Bar disappears when the session finishes.
If VS Code asks you to pick a debugger every time, it could not guess your runtime. Select create a launch.json file in the Run and Debug view and pick your environment to create a permanent configuration. See the launch.json guide for details.
Set a breakpoint
A breakpoint tells the debugger, "pause here so I can look around." Click in the left margin of the editor, next to a line number. A red filled circle appears. You can also place your cursor on a line and press F9.
Start debugging again with F5. The program runs until it reaches your breakpoint, then pauses. The line where execution stopped is highlighted in yellow, and a yellow arrow appears in the left margin.
Now you can inspect the state of your program at that exact moment. Hover over any variable in the editor to see its current value. The VARIABLES section of the Run and Debug view also shows every variable in scope.
To remove a breakpoint, click the red circle again or press F9 on the same line. To disable it without removing it, right-click the breakpoint and select Disable Breakpoint. A disabled breakpoint shows as a gray filled circle and is ignored until you enable it again.
Use the debug toolbar
Once a debug session starts and pauses at a breakpoint, a floating toolbar appears at the top of the editor. Each button controls how execution moves forward.
| Button | Keyboard shortcut | What it does |
|---|---|---|
| Continue | F5 | Resumes execution until the next breakpoint or the program ends. |
| Step Over | F10 | Runs the current line and moves to the next one. If the line calls a function, the function runs completely without stepping into it. |
| Step Into | F11 | If the current line calls a function, enters that function so you can step through it line by line. |
| Step Out | Shift+F11 | Runs the rest of the current function and pauses at the line that called it. |
| Restart | Ctrl+Shift+F5 / Cmd+Shift+F5 | Stops the current session and starts it again from the beginning. |
| Stop | Shift+F5 | Ends the debug session immediately. |
Continue is the one you will use most. Press F5 to run until the next breakpoint after inspecting the paused line. The program finishes when no more breakpoints remain.
Step Over is useful when you want to watch each line execute without diving into functions you trust. Step Into is for when you suspect a bug is inside a function call and want to follow it.
The toolbar location can be changed. Set debug.toolBarLocation in Settings to docked (attached to the Run and Debug view), floating (default), or hidden.
Use the Debug Console
The Debug Console appears automatically when a debug session starts. If you do not see it, press Ctrl+Shift+Y (Windows/Linux) or Cmd+Shift+Y (macOS) or click Debug Console in the panel area.
The Debug Console serves two purposes.
First, it shows your program's output. Any text your code writes to the console appears here automatically while the debugger runs.
Second, it lets you evaluate expressions interactively. While paused at a breakpoint, type any expression into the input box at the bottom. Press Enter and VS Code evaluates it in the context of the current stack frame. The result prints on the next line.
For example, if you are paused inside a function that has a variable user, type user.name in the Debug Console and press Enter. The value appears on the next line. You can also call methods: type user.email.toLowerCase() to see the result.
The Debug Console uses the language mode of your active editor, so you get syntax highlighting and autocomplete suggestions as you type.
A complete debugging workflow
Here is what a real debug session looks like, end to end:
Open your file
Make sure the file you want to debug is the active editor tab.
Set a breakpoint
Click in the left gutter next to the line where you suspect a bug. A red dot appears.
Start debugging
Press F5. Choose your debugger if VS Code asks. The Status Bar turns orange.
Inspect at the breakpoint
When execution pauses, look at the VARIABLES section. Hover over values in the editor. The yellow highlighted line is where execution stopped.
Step through code
Press F10 to move line by line. Watch the VARIABLES section update. If you see a function call you want to investigate, press F11.
Check values in the Debug Console
Type an expression like myVariable.length and press Enter. The result prints immediately.
Continue or stop
Press F5 to run to the next breakpoint or the end. Press Shift+F5 to stop the session.
Troubleshooting
F5 does nothing
Check that a file is open and focused. The Run and Debug view needs an active editor. Also check that you are not on a Markdown or plain text file. VS Code can only debug files with a recognized language.
My breakpoint is gray and hollow
A hollow gray circle means the debugger could not bind the breakpoint. This often happens when the source file on disk does not match the running code, or when the debugger extension cannot map the file to a running process. Try stopping the session, saving the file, and starting again.
I see "Cannot find runtime" when pressing F5
You need to install the runtime or the debugger extension for your language. For Node.js, install Node.js. For Python, install the Python extension. For other languages, search the Extensions view for your language and install the debugger extension.
The Debug Console shows no output
Make sure you are looking at the Debug Console tab, not the Terminal or Output tab. The panel area at the bottom can switch between these. Click the dropdown or use the View: Debug Console command from the Command Palette.
Once you are comfortable starting and stopping debug sessions, learn how breakpoints, conditional breakpoints, and logpoints give you finer control over when your code pauses.
Rune AI
Key Insights
- Open Run and Debug with Ctrl+Shift+D (Cmd+Shift+D on macOS), or click the play-and-bug icon in the Activity Bar.
- Press F5 to start debugging. Pick your debugger from the list the first time. VS Code remembers your choice.
- Set a breakpoint by clicking in the left gutter next to a line number, or pressing F9 on the current line. A red dot appears.
- The debug toolbar has Continue (F5), Step Over (F10), Step Into (F11), Step Out (Shift+F11), Restart, and Stop (Shift+F5).
- The Debug Console (Ctrl+Shift+Y / Cmd+Shift+Y) shows program output and lets you evaluate expressions while paused.
Frequently Asked Questions
What does the orange Status Bar mean?
Do I need to install anything to debug JavaScript or TypeScript?
Why does my program exit before I can see the output?
How do I stop a debug session?
Conclusion
The Run and Debug view is your starting point for finding and fixing problems in your code. Press F5 to start debugging, F9 to set a breakpoint, and use the debug toolbar to control execution. The Debug Console lets you inspect values and run expressions while your code is paused. Once you are comfortable with these basics, learn how breakpoints, conditional breakpoints, and logpoints give you even finer control.
More in this topic
How to Use VS Code with WSL 2 on Windows
Run VS Code connected to Windows Subsystem for Linux so you can develop in a full Linux environment with native tools, terminals, and debugging, all from Windows.
20 Best VS Code Extensions for Web Developers in 2026
Twenty carefully chosen VS Code extensions every web developer should know. Covers formatting, linting, frameworks, debugging, Git, and developer experience.
How to Install, Disable, Update, and Uninstall VS Code Extensions
Learn how to install, disable, update, and uninstall VS Code extensions from the Marketplace and the command line. Step-by-step instructions for every action.