Skip to content

How to

How to make VS Code open links in a specific browser or profile

Updated

VS Code opens links in your system's default browser, and since version 1.92 you can choose another one. Newer versions also open localhost links in their own integrated browser. Here are the two settings, and how to get the right profile, not only the right browser.

Where VS Code sends a link

  • Web links open in your operating system's default browser.
  • Localhost links, such as localhost, 127.0.0.1 and 0.0.0.0, open in VS Code's integrated browser when you click them in the terminal, in chat or in other parts of VS Code.
  • The profile is the browser's choice. Chrome, Edge and Firefox open a link from another app in the window you used last.

So the docs link from your work project can open in your personal profile, and your dev server opens in a browser without your extensions.

Fix 1: choose the browser

  1. Open Settings: Cmd+, on a Mac, Ctrl+, on Windows.
  2. Search for workbench.externalBrowser.
  3. Type chrome, edge or firefox, or the full path to a browser's program.

Or put it in settings.json:

"workbench.externalBrowser": "chrome"

You can set it per workspace too, for example Firefox in one project and Chrome in another. It picks the browser, not the profile: VS Code's docs don't describe a way to pass a profile to it.

Fix 2: localhost links in your own browser

To open localhost links in your real browser, with your extensions and sign-ins, turn off the integrated browser for them:

"workbench.browser.openLocalhostLinks": false

They then go to the browser from Fix 1, or to your default browser. Cursor and other editors built on VS Code have these settings too, but users report that Cursor doesn't always follow them for localhost links.

Fix 3: the right profile for each link

One browser for every link doesn't help when your GitHub is in Work and your YouTube is in Personal. Something has to decide per link.

Profile Porter does this on Mac and Windows. Make it your default browser, and leave workbench.externalBrowser empty, so VS Code uses the default. Each link then opens in the Chrome, Edge, Brave, Firefox or Safari profile where you use that site, which it reads from your browsers on your computer. When two profiles are close, it asks, and remembers your answer.

It works for every app, not only VS Code: the terminal, Slack and your email go through it too. For a site that must always go to one profile, add a rule in Settings › Sites.

Get Profile Porter for €12, once.

Everything included, no account, and a full refund within 14 days if it isn't for you. macOS 14 or later; on Windows 10 and 11, get it from the Microsoft Store.