VS Code Server is the small backend that VS Code starts on a remote machine so that the editor on your computer, or in a browser, can work with files, terminals and extensions on that machine. The quickest way to get one is to run code tunnel on the remote machine and open the URL it prints.
"VS Code server" is also used for a different project, code-server by Coder, so this article separates the two. It covers what Microsoft's server does, how to start it, how to keep it running, how to connect, and when to choose something else.
What is VS Code Server?
Microsoft's documentation describes it as "a service you can run on a remote development machine" that works without the requirement of SSH. It is built on the same server that the Remote Development extensions use. On top of that it adds an interactive CLI and secure connections to vscode.dev.
The split is simple. The VS Code interface runs on the machine in front of you, or in a browser tab. The server runs where your code lives. File access, the integrated terminal, the debugger and language tooling all execute on the remote side, so the remote machine needs the compilers and runtimes, not your laptop.
You never download the server separately. The code command-line interface fetches and starts it for you.
How to start VS Code Server with code tunnel
Run this on the remote machine, which can be a desktop, a home server or a VM:
code tunnel
Microsoft's wording is that the command "downloads and starts the VS Code Server on this machine and then creates a tunnel to it." The first time, you are prompted to accept the server license terms and to sign in with GitHub or Microsoft. The CLI then prints a URL of this form:
https://vscode.dev/tunnel/<machine_name>/<folder_name>
Open that URL in any browser to get the editor with the remote machine behind it. To skip the license prompt in scripts, pass --accept-server-license-terms. If you installed the standalone CLI and not the desktop app, the same command is ./code tunnel. Run code tunnel --help to see every option for your version.
Connect from desktop VS Code or from a browser
You have two clients to choose from.
- Browser. Open the
vscode.dev/tunnel/...URL. The first time from a given client, you are asked to log in to GitHub. This is the same web editor described in VS Code for the web, except that the terminal and debugger work, because the code runs on the remote machine. - Desktop VS Code. Install the Remote - Tunnels extension (
ms-vscode.remote-server), open the Command Palette and run Remote Tunnels: Connect to Tunnel. Machines are also listed in the Remote Explorer view.
Hosting and connecting both require the same GitHub or Microsoft account on each end. A tunnel is not a public link that anyone can open.
Keep the server running after you log out
A tunnel only works while VS Code or the CLI is running on the remote machine. A plain code tunnel in a terminal ends when you close that terminal or press Ctrl+C. Microsoft documents these options:
| Goal | Command |
|---|---|
| Run as a background service that starts again later | code tunnel service install |
| Remove that service | code tunnel service uninstall |
| Stop the machine from sleeping while the tunnel runs | code tunnel --no-sleep |
| Remove this machine's tunnel registration | code tunnel unregister |
From inside VS Code you can also run Remote Tunnels: Turn off Remote Tunnel Access... from the Command Palette.
Is it secure?
Microsoft's documentation makes these points:
- Connections are encrypted end to end. When you connect, an SSH connection is created over the tunnel, and the page names AES 256 in CTR mode as the cipher.
- VS Code does not set up any network listeners on the remote machine. It makes outbound connections to a service hosted in Azure, so no firewall changes are generally necessary.
- If you need to control this on a managed network, you can allow or deny the domain
global.rel.tunnels.api.visualstudio.com.
The trust model still matters. Whoever can sign in to your GitHub or Microsoft account can reach the machine, including its terminal. Turn on two-factor authentication for that account, and unregister machines you no longer use.
Limits to know before you rely on it
- One user per server. The documentation says an instance of the server is designed to be accessed by a single user, and that hosting it as a service is not allowed under the license. It is for your own machines, not for serving a team.
- 10 tunnels per account. If you register an eleventh, the CLI deletes a random unused one.
- Some extensions are missing in a browser. Pure UI extensions are not supported in a web-based instance.
- Settings Sync secrets. If no keyring is set up on the remote machine, Settings Sync uses an in-memory secret, so secrets persist only for the lifetime of the server.
- Telemetry. You can turn it off with
code tunnel --disable-telemetry, or set a level with--telemetry-level.
VS Code Server vs code-server by Coder
The names are nearly the same and the products are not. code-server is an open-source project, under the MIT license, whose own description is "Run VS Code on any machine anywhere and access it in the browser." You install and host it yourself, with no Microsoft tunnel in the middle.
| VS Code Server (Microsoft) | code-server (Coder) | |
|---|---|---|
| Started with | code tunnel | code-server after installing it |
| How you reach it | Microsoft-hosted tunnel, same GitHub or Microsoft account | Your own address and port, with a password |
| Inbound ports needed | None | You choose how to expose it |
| License | Server license terms, single user | MIT |
Per Coder's setup guide, code-server listens on 127.0.0.1:8080 by default (bind-addr in ~/.config/code-server/config.yaml) and uses password authentication, with the password in that file. Login attempts are rate limited to two per minute plus an additional twelve per hour. The install script from the project page is:
curl -fsSL https://code-server.dev/install.sh | sh
The same page offers -s -- --dry-run after sh to preview what the script would do, which is worth doing before you pipe any script into a shell. Because the default is localhost only, the guide's safest remote setup is an SSH tunnel from your own machine:
ssh -N -L 8080:127.0.0.1:8080 [user]@<instance-ip>
Then open http://127.0.0.1:8080 locally. For how that command works, see SSH port forwarding. The guide warns never to expose code-server to the internet without authentication and encryption, because "someone can take over your machine via the terminal." For a public domain it recommends HTTPS through Let's Encrypt with Caddy or NGINX.
Which option should you use?
Microsoft's overview lists four Remote Development extensions: SSH, Dev Containers, WSL and Tunnels. For reaching a machine from elsewhere, the choice is between two of them.
- You can already SSH into the machine. Use the Remote - SSH extension. It connects to "any location" over SSH and needs no Microsoft-hosted tunnel.
- You cannot or will not set up SSH, for example a home PC behind a router. Use
code tunnel. - You want a browser editor on a server you fully control, with no dependence on a Microsoft account. Look at code-server, and secure it as described above.
If it does not work
- The tunnel is offline. The server is not running. Start
code tunnelagain on the remote machine, or install it as a service so it survives restarts. - The machine disappeared from the list. You may have passed the limit of 10 tunnels per account, and the CLI deleted an unused one. Run
code tunnelagain to register it. - The login loop in the browser. Sign in with the same GitHub or Microsoft account that you used when you started the tunnel.
- A bug report is needed. Run
code -v tunnelfor verbose logging. - Nothing connects on a locked-down network. Ask your network administrator whether outbound access to
global.rel.tunnels.api.visualstudio.comis blocked.
Frequently asked questions
- Is VS Code Server free?
- Using it costs nothing, but it is covered by its own license terms that you must accept on first run. Microsoft's documentation says hosting it as a service is not allowed, and that an instance is designed to be accessed by a single user. code-server by Coder is a separate project under the MIT license.
- Do I need SSH to use VS Code Server?
- No. The Remote Tunnels route connects through a tunnel hosted by Microsoft, so you do not configure SSH or open inbound ports. Microsoft says no firewall changes are generally necessary because the machine makes outbound connections only. If you already have SSH access to a machine, the Remote - SSH extension is the other supported route.
- How many tunnels can one account have?
- Microsoft's documentation says each account can have 10 registered tunnels. If you create another, the CLI picks a random unused tunnel and deletes it. Run code tunnel unregister on machines you no longer use to keep the list tidy.
- Is code-server the same as VS Code Server?
- No. VS Code Server is Microsoft's remote backend, started by code tunnel or by the Remote extensions. code-server is a separate open-source project from Coder that serves VS Code in a browser from a machine you run, with its own password login and config file.