The right way to preview a VS Code project depends on what you are opening. For a standalone HTML file, use VS Code Desktop’s integrated browser. For an app that needs a development server, start that server and open its localhost URL. If you are working remotely or need someone else to reach the running app, use port forwarding—but remember that forwarding exposes a service; it does not start it.
Choose the right preview method
First decide whether you have a file to display or an application that must run. A static HTML file can be opened directly. A project that relies on a framework, server-side code, build steps, or other runtime needs its normal development server running before a browser can show the app. The options also differ by workspace location and audience:
- One local HTML page, viewed on your computer: open it in VS Code’s integrated browser.
- A web app with a development server: run the project’s usual command, then open its localhost address.
- A running service in a remote workspace, or a service another person must reach: forward its port and choose the appropriate visibility.
- Editing files in a browser: use vscode.dev, but do not confuse the browser-based editor with a runtime for your application.
Microsoft’s integrated browser documentation covers local HTML and localhost pages; its HTML guide describes the file-preview workflow.
Preview a single HTML file in VS Code Desktop
Use this route when you want to inspect a simple page and do not need a server to generate it. It is the quickest option for a standalone .html or .htm file in a local workspace.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problems#1 Best Overall
- Open the project folder in VS Code Desktop and find the .html or .htm file in the Explorer.
- Right-click the file and select Open in Integrated Browser. You can also use the editor-tab context menu or the documented editor toolbar preview action.
- Edit and save the HTML. The preview updates in real time, so you can check the rendered result as you work.
This direct preview uses a local file:// URL. That distinction matters: file URLs are not available for remote or virtual workspace resources. If the page depends on a server, client-side routing, generated assets, or an application runtime, open it through the running server instead of treating the file preview as a complete app launch.
Run a web app and open its localhost URL
For a web application, VS Code does not guess the correct start command: it depends on the project. Use the command specified by its README, package scripts, framework instructions, or team documentation. The server must finish starting before a browser can load the page.
Rank #2
- Open the project’s integrated terminal with Terminal > New Terminal.
- Run the project’s documented development-server command. Do not substitute a generic command unless the project calls for it.
- Read the terminal output for the local address and port—for example, an address beginning with
http://localhost:. - Open that localhost link in VS Code’s integrated browser or a regular browser. VS Code opens localhost links in its integrated browser by default.
The integrated browser includes a Developer Tools action in its toolbar, which is useful for inspecting a rendered page. If you use an external browser instead, its own developer tools remain available. For more control over rendering, debugging, or browser-specific behavior, an external browser can be a better fit.
Or skip the browser setup
For a URL that the ScreenshotNeo service can reach, ScreenshotNeo returns a screenshot or PDF through a GET request. This is useful for capturing a deployed page or another accessible site; it does not run a VS Code project or reach a private localhost server on your computer. Keep using the local browser workflow above to interactively preview code during development.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Here is a one-request example using a publicly accessible URL. Replace the sample URL with the page you want to capture and use your own API key. See the ScreenshotNeo API documentation for request options and response details.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
ScreenshotNeo accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each of those steps can be turned off. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and the response identifies the page verdict and billing status in headers. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. The free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots.
Sign up for ScreenshotNeo’s free plan to try it with 1,000 screenshots a month and no card.
Rank #4
Forward a port for a remote workspace or shared access
Port forwarding makes a running local service reachable through an address. It is not a server launcher: start the app first, then forward the port it is listening on. This is useful when VS Code is connected to a remote machine or when a teammate needs to reach a preview.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →- Start the app’s development server and note its port.
- Open the Ports view in VS Code.
- Select Forward a Port, then enter the port number or accept the suggested port.
- Use the forwarded port’s available action to copy its address, open it in a browser, or open an in-editor preview.
Microsoft uses npx serve on port 3000 as an example of starting a service before forwarding it. That is an illustration, not a universal command or required port; follow your project’s instructions and use the port its server actually reports. See Microsoft’s Port Forwarding documentation for the view and available actions.
Choose visibility carefully
Forwarded ports are private by default. Microsoft’s documentation explains that, by default, hosting and connecting to a tunnel require authentication with the same GitHub or Microsoft account on each end. Public visibility changes the access model: anyone with the link can access the service. Do not make a confidential project or an insecure development service public just to make sharing easier. Forward only what you need and keep the intended audience in mind.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Use the integrated browser with a remote workspace
The integrated browser can proxy HTTP and HTTPS requests over a remote connection when workbench.browser.enableRemoteProxy is enabled. Microsoft describes this remote-proxy behavior as preview functionality. With proxying enabled, localhost links retain the remote URL; without it, they open the forwarded local URL. File URLs are not proxied, so the direct local-file preview workflow is not a substitute for opening a remote app served over HTTP or HTTPS. See the integrated browser documentation for the current behavior.
If a remote page does not open as expected, check whether the service is running on the remote machine, whether the correct port is forwarded, and whether remote proxying is enabled for the behavior you intend. The local file and remote HTTP workflows are different; changing one will not make a remote file URL available through the proxy.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallWhen vscode.dev is—and is not—the answer
vscode.dev is Microsoft’s free, zero-install VS Code experience in a browser. It is useful for browsing repositories and lightweight editing. It is not the same as running the project in a browser: Microsoft says the web editor does not include the terminal or debugger. If the project needs a runtime, build command, or debugging, use desktop VS Code, Codespaces, or Remote Tunnels as appropriate to your setup.
Debug the page after it opens
Opening a preview confirms that a browser can load the page, but it does not by itself debug the application. VS Code supports browser debugging with Edge or Chrome and also supports debugging inside its integrated browser using the editor-browser launch type. Treat this as a next step after the relevant page is reachable; browser debugging is not required for a basic visual preview. Microsoft’s browser debugging guide covers the supported approaches and launch configuration.
Quick Recap
Troubleshooting common preview failures
| What you see | Likely reason | What to do |
|---|---|---|
| The HTML file will not open in the integrated browser | The workspace resource is remote or virtual, or the file is not a standalone local HTML file. | For a local .html or .htm file, use the Explorer or editor-tab context menu and choose Open in Integrated Browser. For remote content, serve it over HTTP or HTTPS and open the server URL instead of a file URL. |
| A web app shows an error, blank page, or old content | The development server may not be running, may have failed to start, or may be listening at a different address or port. | Check the terminal for the server’s startup message and errors, then open the exact localhost address it reports. Use the project’s documented start command rather than assuming one. |
| The localhost link opens the wrong destination from a remote workspace | Remote proxying and port forwarding handle localhost differently. | Check workbench.browser.enableRemoteProxy and the forwarded port in the Ports view. With the proxy enabled, localhost links retain the remote URL; otherwise they open the forwarded local URL. |
| A teammate cannot access the forwarded address | The port may remain private, or the person may not meet the tunnel’s authentication requirement. | Check the port’s visibility and the account used to connect. Microsoft documents same-account GitHub or Microsoft authentication by default; make a port public only when anyone with the link should be able to reach the service. |
| The browser editor cannot start or debug the application | vscode.dev does not provide the terminal or debugger. | Use desktop VS Code, Codespaces, or Remote Tunnels for the runtime and debugging capabilities the project needs. |
| Previewing one HTML file does not reproduce the whole app | The page may depend on a server, generated files, or application behavior that a direct file URL does not provide. | Start the project’s normal development server and inspect its localhost page instead of relying on a file preview. |
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

