# How to open VS Code in the browser Run code-server, the open-source build of VS Code for the web, on a machine and open its port in your browser. There are three ways to get VS Code in a browser tab, and they differ in where your code runs: | Option | Where the code runs | Terminal and extensions | | ------------------------------ | ------------------------ | -------------------------------- | | vscode.dev | Nowhere: files only | No terminal; web extensions only | | code-server on your own server | The server you run it on | Full terminal and extensions | | A hosted dev environment | A machine made for you | Full terminal and extensions | vscode.dev edits files in the browser, but it has no machine to run a build, a test or a server. For that, the editor's server side has to run on a real machine, which is what code-server does. **On Runtime, a dev environment runs code-server on port 8080 over `/workspace`, on a Linux machine of its own. A private HTTPS preview opens it in your browser, and the editor's terminal runs on that machine.** Nothing is installed on your computer ([Dev environments](/docs/workspaces)). ## Run code-server on your own machine ```bash no-run curl -fsSL https://code-server.dev/install.sh | sh code-server --bind-addr 127.0.0.1:8080 /path/to/project ``` code-server writes a password to `~/.config/code-server/config.yaml`. Keep it bound to `127.0.0.1` and reach it through an SSH tunnel or a proxy with TLS. Anyone who reaches it can run commands as its user. ## Open it on Runtime This creates a dev environment, shares port 8080 with a private preview, and prints a link that opens VS Code on `/workspace`: ```bash no-run API=https://api.withruntime.com AUTH="Authorization: Bearer $RUNTIME_API_KEY" JSON="Content-Type: application/json" id=$(curl -sf -X POST "$API/v2/workspaces" -H "$AUTH" -H "$JSON" -d '{}' | jq -r .id) preview=$(curl -sf -X POST "$API/v2/sandboxes/${id}/previews" -H "$AUTH" -H "$JSON" \ -d '{"port": 8080}') echo "$(echo "$preview" | jq -r .url)?folder=/workspace&runtime_preview_token=$(echo "$preview" | jq -r .token)" ``` The `folder` query picks the folder VS Code opens. To open a project you cloned, point it there: `?folder=/workspace/express`. ## Who can open the link The preview is private. The link carries a token, and without it the address answers `401`. The token lasts up to a day by default; ask for a shorter or longer one with `ttlSeconds` when you create the preview, and rotate it to cut off every link given out so far ([rotate a preview token](/how-to/rotate-a-preview-token)). Treat the link like a password. Anyone holding it can use the editor's terminal on the machine. ## Show it inside your own app To put the editor in an iframe in your own product, an online IDE or a course platform, list your site in `embedOrigins` when you create the preview. Sites not on the list cannot frame it ([previews](/docs/reference/previews#previewcreate)). ```bash no-run curl -sf -X POST "$API/v2/sandboxes/${id}/previews" -H "$AUTH" -H "$JSON" \ -d '{"port": 8080, "embedOrigins": ["https://app.example.com"]}' | jq -r .url ``` ## Related - [How to set up a cloud development environment](/how-to/set-up-a-cloud-dev-environment) - [How to run Jupyter in the cloud](/how-to/run-jupyter-in-the-cloud) - [What is a Jupyter kernel?](/glossary/jupyter-kernel) - [How to build a browser-based online IDE](/use-cases/online-ide) - [How to open a cloud sandbox in VS Code with Remote-SSH](/how-to/use-vs-code-remote-ssh) ## Sources - [code-server: install](https://coder.com/docs/code-server/install), read 17 November 2026 Facts on this page were checked on 17 November 2026.