For a standalone HTML file in Visual Studio 2022, open the file, place the cursor in its editor, then choose File > View in Browser or press Ctrl+Shift+W. You can also right-click in the editor and choose View in Browser. If the HTML belongs to a web project, use F5 or Ctrl+F5 instead. Those commands start the project and open its running URL.
Choose the workflow that matches your HTML
Visual Studio has two different ways to show a page. A single local .html file can be sent directly to a browser. A project page must normally be served by the project because it may depend on routing, server-side code, bundled assets, configuration, or an HTTPS profile.
| What you have open | Command | What happens | Debugging |
|---|---|---|---|
| One local HTML file | File > View in Browser or Ctrl+Shift+W | The selected file opens in a browser | None; it is a direct preview |
| Web project | F5 or Debug > Start Debugging | Visual Studio builds and starts the app, then opens its URL | Enabled |
| Web project without a debugger | Ctrl+F5 | Visual Studio runs the app and opens its URL | Disabled |
| Another installed browser | File > Browse With… | You choose a browser for Visual Studio’s viewing workflow | Depends on the underlying command |
Open a standalone HTML file
- Open the file. If it is not already in an editor, select File > Open > File… and choose the
.htmlfile. - Give the HTML editor focus. Click inside the document. Visual Studio may enable the command only when the HTML editor is the active window.
- Launch the preview. Select File > View in Browser. The keyboard shortcut is Ctrl+Shift+W. You can get the same result by right-clicking in the editor and selecting View in Browser.
- Inspect the result. The browser loads the file using a local address. Save edits in Visual Studio and refresh the browser to see changes.
This route is intended for a self-contained page. Relative CSS, JavaScript, image, and font paths resolve from the file’s location, so keep the expected folder structure intact.
Select a different browser with Browse With
To use a browser other than the current default for Visual Studio, choose File > Browse With…. Select an installed browser and, if desired, set it as the default for Visual Studio’s browser commands. This preference belongs to Visual Studio; it does not change the default browser configured in Windows.
#1 Best Overall
Use Browse With when you need to compare rendering in Edge, Chrome, Firefox, or another installed browser. Browser availability and menu wording can vary with the Visual Studio edition, installed components, and release.
Run an HTML page that belongs to a web project
ASP.NET Core and similar projects
When the page is part of an ASP.NET Core project, do not treat it as an isolated file if it depends on the application. In Solution Explorer, select the intended run target or startup project, then press F5 or select Debug > Start Debugging. Visual Studio builds the project, starts its development server, and opens the configured browser URL.
For a run without the debugger, press Ctrl+F5. This still starts the application and opens it in a browser, but it does not attach the debugger. Use this mode when you want normal application behavior without breakpoints and debugging overhead.
Rank #2
Why direct file viewing may not work for a project page
- Server-side Razor, MVC, authentication, or route processing requires the application to run.
- Relative URLs may be rooted at the application’s configured base path rather than the file’s folder.
- Generated bundles, API calls, environment variables, and middleware exist only when the project server is active.
- A direct
file://preview can trigger browser security restrictions that do not occur over the development server.
When “View in Browser” is missing
Confirm that the correct editor has focus
Click inside the HTML document and check the extension. The command is associated with an open HTML file, not a solution node, project folder, CSS file, or Output window.
Open the file directly
Use File > Open > File… and select the file again. Then check the File menu while that document is active. This is the specific recovery path recommended in the Microsoft Q&A guidance for a missing command.
Check whether you are using Visual Studio or Visual Studio Code
Visual Studio IDE and Visual Studio Code are separate products with different commands and extensions. The steps in this article apply to Visual Studio 2022 IDE. If the window says Visual Studio Code, its preview workflow is not the same.
Rank #3
Account for version differences
A Microsoft External Staff response reported the command working in Visual Studio 2022 versions 17.11.2 and 17.11.3 on September 11, 2024. That is dated, version-specific evidence rather than a promise that every later release, edition, or configuration exposes an identical menu. If your installation differs, update Visual Studio through the Visual Studio Installer and verify that the HTML/web tooling is installed.
Common problems and fixes
| Symptom | Likely cause | Fix |
|---|---|---|
| The menu item is unavailable | The active window is not the HTML editor, or the file is not recognized as .html |
Open the file with File > Open > File…, click in it, and verify the extension. |
| The page is blank or styles are missing | Broken relative paths or a stylesheet/script that expects a web server | Inspect browser developer tools, correct paths, or run the containing project with F5/Ctrl+F5. |
| Server-side markup appears as text or does not render | The file was opened directly instead of through its project | Start the project and use its generated URL. |
| Changes do not appear | The file was not saved or the browser is showing a cached resource | Save the file, refresh the page, and use a hard refresh when a cached CSS or JavaScript asset is involved. |
| The wrong browser opens | Visual Studio’s browser preference differs from Windows’ default | Choose File > Browse With…, select the browser, and set the Visual Studio default. |
| F5 fails to launch the app | No startup project, invalid launch profile, build error, or occupied port | Set the correct startup project, read the Error List, repair the launch profile, and resolve the reported port or build problem. |
Inspect the page when the visual result is wrong
- Open the browser’s developer tools and check the Console for JavaScript errors.
- Use the Network panel to find 404 responses for CSS, scripts, fonts, or images.
- Confirm that the address is the expected local file or project URL.
- For a project, verify that the selected launch profile, port, HTTPS setting, and environment are the ones your page expects.
- Test in a second browser through Browse With before changing valid HTML or CSS solely to address a browser-specific rendering issue.
Or skip the browser setup
If your goal is an image or PDF of a page rather than interactive debugging, ScreenshotNeo can capture a URL with one request. It accepts consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be disabled. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and the response identifies the page verdict and billing status in X-Page-Verdict and X-Billed headers.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errorsFor a public page, obtain an API key and run:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo documentation for all request options. The equivalent Python request is:
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)
Node.js:
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`${res.status} ${res.statusText}`);
require('fs').writeFileSync('shot.webp', Buffer.from(await res.arrayBuffer()));
ScreenshotNeo also provides an MCP server for Claude, Cursor, and other MCP clients, with take_screenshot, get_page_info, and capture_pdf tools. Options include full-page and element capture, device presets and custom viewports, retina scale, dark mode, custom CSS/JavaScript, click and wait actions, request blocking, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, caching with a chosen TTL, signed image links, asynchronous webhooks, bulk capture of up to 100 URLs per call, usage data, and an OpenAPI specification.
Rank #4
The Free plan includes 1,000 shots each month with no card. Paid plans start at $5 for 3,000 shots; every feature is available on every plan. Create a free ScreenshotNeo account.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Practical choice: file preview or project run?
- Choose View in Browser for a standalone HTML file that needs a quick visual check.
- Choose F5 when you need breakpoints, server-side processing, or the complete application environment.
- Choose Ctrl+F5 when you need the running project without attaching the debugger.
- Choose Browse With… when browser selection or cross-browser comparison matters.
Frequently Asked Questions
Does View in Browser start a local web server?
For a standalone file, it opens the file directly in a browser. It does not replace starting the server for an application that requires project processing.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteCan I preview an HTML file without creating a project?
Yes. Open the file directly in Visual Studio and use File > View in Browser or Ctrl+Shift+W.
Best Value
What is the difference between F5 and Ctrl+F5?
F5 starts the project with debugging; Ctrl+F5 starts it without debugging.
Does Browse With change my Windows default browser?
No. It changes the browser Visual Studio uses for its own viewing and testing commands.
Quick Recap
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.
Recommended Free Tools

