How to Fix VS Code Unable to Connect to Browser on Windows 11

Visual Studio Code (VS Code) is one of the most popular editors for building and debugging web applications. It allows you to open, edit, and preview your code directly in a browser — but sometimes, when you try to run a project or launch a live preview, you might encounter an error like: “Unable to connect to browser” or “Cannot connect to Chrome – please check if it’s installed or running.”

If that sounds familiar, don’t worry — it’s a common issue caused by browser or extension configuration problems.

In this guide, we’ll walk you through the main causes and provide step-by-step fixes to get your browser connected to VS Code again.

Why VS Code Fails to Connect to Browser

Several issues can cause this problem — here are the most common ones:

  • Live Server extension misconfiguration
  • Firewall or antivirus blocking local ports
  • Corrupted browser or VS Code settings
  • Debugger or runtime path not set correctly
  • Outdated extensions or VS Code version
  • Chrome/Edge not installed in the default path

Now let’s go step-by-step through the working fixes.

1. Restart VS Code and Browser

Before diving into deeper troubleshooting, start with the basics.

  1. Close all running instances of VS Code and your browser.
  2. Press Ctrl + Shift + Esc → open Task Manager.
  3. End all Code.exe and chrome.exe / msedge.exe processes.
  4. Reopen VS Code and try launching the project again.

Why this helps: Sometimes, background processes interfere with VS Code’s connection to the browser, especially after debugging sessions.

2. Check Live Server Extension Configuration

If you’re using the Live Server extension to open your HTML project in a browser, it might not be configured properly.

  1. In VS Code, click the gear icon at the bottom left → Settings.
  2. Search for Live Server.
  3. Scroll down and check these settings:
    • Custom Browser: Ensure it’s set to your browser name (e.g., chrome or edge).
    • Port Number: Default is usually 5500. Change it if another app uses the same port.
  4. Restart VS Code and click Go Live again.

Pro Tip: You can manually set the browser using a command:

Ctrl + Shift + P → Preferences: Open Settings (JSON)

Then add this line:

"liveServer.settings.CustomBrowser": "chrome"

3. Set Chrome or Edge as Default Debugging Browser

If you’re debugging using the Debugger for Chrome or Debugger for Edge extension, you may need to update your launch configuration.

1. Open your project folder in VS Code.

2. Go to the .vscode folder → open launch.json.

3. Make sure the configuration looks like this:

For Chrome:

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "chrome",
      "request": "launch",
      "name": "Launch Chrome",
      "url": "http://localhost:5500",
      "webRoot": "${workspaceFolder}"
    }
  ]
}

For Edge:

{
  "type": "pwa-msedge",
  "request": "launch",
  "name": "Launch Edge",
  "url": "http://localhost:5500",
  "webRoot": "${workspaceFolder}"
}

4. Save the file and click Run → Start Debugging (F5).

Note: Replace 5500 with your actual server port if you use a different one.

4. Allow VS Code Through Windows Firewall

Windows Firewall might block VS Code or Live Server from opening a port.

  1. Press Windows + I → Privacy & Security → Windows Security → Firewall & network protection.
  2. Click Allow an app through firewall.
  3. Find Visual Studio Code (or add it manually if not listed).
  4. Check both Private and Public boxes.
  5. Click OK, then restart VS Code.

Pro Tip: If you’re using WAMP, XAMPP, or any local server tool, allow them through the firewall too.

5. Update or Reinstall the Browser Debugging Extension

Sometimes, the Debugger for Chrome or Debugger for Edge extension itself is outdated or corrupted.

  1. In VS Code, press Ctrl + Shift + X to open Extensions.
  2. Search for:
    • “Debugger for Chrome”
    • “Debugger for Microsoft Edge”
  3. Uninstall the extension.
  4. Restart VS Code, then reinstall the latest version.

After reinstalling, retry launching your project using F5.

6. Update or Reinstall Visual Studio Code

If the problem persists, it might be a deeper issue with VS Code itself.

  1. Go to https://code.visualstudio.com/.
  2. Download the latest version of VS Code.
  3. Install it over your existing version (no need to uninstall).
  4. Once updated, open your project and test again.

Why this helps: Older builds may not support new debugging APIs or browser updates.

7. Verify Chrome or Edge Installation Path

If your browser isn’t installed in the default directory, VS Code may fail to detect it.

  1. Press Windows + R → type: where chrome or where msedge
  2. Copy the path it shows (e.g., C:\Program Files\Google\Chrome\Application\chrome.exe).
  3. Add that path to your launch.json configuration manually:
    "runtimeExecutable": "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"
  4. Save and restart debugging.

8. Run VS Code as Administrator

Sometimes, permission issues block VS Code from opening ports for Live Server or debugging.

  1. Right-click the VS Code icon.
  2. Select Run as administrator.
  3. Try launching your project again.

If it works, you can make this permanent:

  • Right-click the shortcut → Properties → Compatibility → Check “Run this program as administrator” → Apply → OK.

9. Disable Conflicting Extensions

Extensions like Prettier, Path Intellisense, or Live Preview can sometimes conflict with Live Server.

  1. Press Ctrl + Shift + X → open Extensions.
  2. Disable all except Live Server and Debugger.
  3. Restart VS Code and test again.

If it works, re-enable extensions one by one to find the culprit.

10. Reset VS Code Settings

If none of the above fixes work, reset your VS Code settings to factory defaults.

  1. Press Ctrl + Shift + P → type: Preferences: Open Settings (JSON)
  2. Delete all custom configurations inside and save the file.
  3. Restart VS Code — it’ll recreate default settings.

Alternatively, delete:

%AppData%\Code\User\settings.json

Wrapping Up

If VS Code can’t connect to your browser, it’s usually due to Live Server or Debugger misconfiguration, blocked ports, or missing permissions.

Start by restarting VS Code, setting the correct browser in Live Server settings, and ensuring both VS Code and your browser are allowed through Windows Firewall. If the issue persists, update or reinstall VS Code, your browser, or the Debugger extension.

With these fixes, you’ll be able to preview and debug your web projects directly from VS Code — just as intended.

Posted by Arpita

With a background in Computer Science, she is passionate about sharing practical programming tips and tech know-how. From writing clean code to solving everyday tech problems, she breaks down complex topics into approachable guides that help others learn and grow.