HTML Preview & HTML Viewer (Live, CSS and Images, Offline)

HTML Preview & HTML Viewer (Live, CSS and Images, Offline), a VS Code extension by Zovo

See your HTML page beside its code in VS Code, with its CSS, JavaScript and images. Free, no sign-in, works offline. It sends nothing anywhere and loads nothing from the web unless you click "Load for this file".

Install in VS CodeOpen the Marketplace page

Free, MIT license. Needs VS Code 1.90.0 or newer. Extension ID zovo.zovo-html-preview, version 0.2.1.

A small site in VS Code: index.html on the left, the live preview on the right with its CSS, images and script working

A real 3-file site (samples/site/index.html, its CSS with @import and url(), a script and two images) in VS Code 1.142, dark theme.

Questions people ask

Is HTML Preview & HTML Viewer (Live, CSS and Images, Offline) free?

Yes. HTML Preview & HTML Viewer (Live, CSS and Images, Offline) is free and MIT licensed.

How do I install HTML Preview & HTML Viewer (Live, CSS and Images, Offline)?

Click "Install in VS Code" above, or search for zovo.zovo-html-preview in the Extensions view.

Open it

Open an .html file and click the preview icon at the top right of the editor, or press Cmd+K V (Ctrl+K V on Windows and Linux). The preview opens to the side. Your .html file stays a normal text editor: this extension never takes it over, and it does not use Ctrl+Shift+V.

Why another HTML preview

The two most installed "HTML Preview" extensions were last updated in 2018. Their reviews and issues name the same problems again and again. This one fixes them:

  1. CSS and images show. Linked stylesheets, @import, CSS url(), scripts, srcset, <picture>, fonts, video and local iframes all load, from relative paths, ../ paths, / paths (the workspace folder is the site root), paths with spaces and names in any language. <base href> is followed.
  2. It updates as you type. The preview follows the editor, without saving. Save a linked CSS, JS or image file and the preview updates within a moment, even when you did not touch the HTML. The scroll position stays where it was.
  3. It works, and it is safe. No local web server and no port. The page runs in a sandboxed frame that cannot reach VS Code, your other files or the network. A page stuck in an endless loop is stopped after 5 seconds, and VS Code stays responsive.

It is also on Open VSX, so it works in Cursor, Windsurf, VSCodium and other editors based on VS Code. It reads files through VS Code, so it works over Remote-SSH, WSL and in dev containers too.

Features

The same page at 375 px, a phone width
The console panel with a log line, a warning, an alert and a script error, light theme
The bar for a Bootstrap page from a CDN: 4 web resources, nothing loaded
The same small site in the light theme

Large files

HTML files up to 10 MB open at once; a 1.7 MB table with 10,000 rows shows in about a second. Larger files show a message first and are not read until you click "Show anyway" (setting htmlPreview.maxFileMB). Files over 32 MB are never shown. Linked files over 25 MB (a big video, for example) are left out and named in the console (setting htmlPreview.maxResourceMB).

Privacy and safety

Settings

SettingDefaultWhat it does
htmlPreview.followActiveEditortrueThe preview shows the HTML file you switch to
htmlPreview.updateDelayMs300Wait after typing before the preview updates
htmlPreview.runScriptstrueRun the page's JavaScript (sandboxed)
htmlPreview.loadRemoteResourcesfalseLoad CSS, fonts, scripts and images from the web in every page
htmlPreview.pageBackgroundautoColors for pages that set none: auto, light or dark
htmlPreview.scrollSyncfalseScroll the preview with the editor
htmlPreview.maxFileMB10Larger HTML files wait for "Show anyway"
htmlPreview.maxResourceMB25Larger linked files are left out
htmlPreview.stuckScriptSeconds5Stop page scripts that keep the preview busy this long
htmlPreview.askForRatingtrueAsk for a rating once you have used it on a few days
htmlPreview.showSupportLinkstrueShow the small Sponsor and More free viewers links

Limits

Guides

Install HTML Preview & HTML Viewer (Live, CSS and Images, Offline)

Click the button to open VS Code and install it, or press Ctrl+P (Cmd+P on macOS) in VS Code and run ext install zovo.zovo-html-preview.

Free, MIT license. Needs VS Code 1.90.0 or newer. Extension ID zovo.zovo-html-preview, version 0.2.1.

Source code and issues are on GitHub.

All our VS Code extensions

Support this work

If this extension saves you time, you can support the work on GitHub Sponsors. Monthly tiers start at $5, and one-time tiers start at $15. Sponsorship is optional, and the tool works the same without it.

Need your format supported?

Open a format request with a sample file, and I reply there whether it can be done. For USD 299 once, through this GitHub Sponsors tier, I add your file format or a missing feature to this extension, with tests, within 7 days.