HTML Viewer
Free online HTML viewer: paste HTML code and see it rendered live in a secure sandboxed preview. Check snippets, emails and templates with scripts off.
Runs in your browser · Nothing uploadedFree · No sign-up
Something not working, or missing a feature? Send feedback
About the HTML Viewer
This free online HTML viewer renders HTML code live as you type: paste a snippet or open an HTML file from your computer and the page is displayed as a browser would show it. The preview runs inside a sandboxed frame that cannot reach the rest of the site, so you can check snippets, emails or templates safely, and the file is read in your browser, never uploaded. For Razor (.cshtml), PHP or other server templates, paste the HTML the server renders. Whether you call it an HTML previewer, an HTML reader or an HTML code viewer, it does the same job: a browser-based tool to render HTML online.
Everything runs in your browser, so your input is never uploaded to a server.
How to use the HTML Viewer
- Paste or type HTML in the editor, click "Open file" or drop an .html file on the editor.
- Watch the preview update as you type.
- Switch on "Run scripts" only if your snippet needs JavaScript.
Common mistakes
- Relative links and images. The preview has no base URL, so src="images/logo.png" cannot load. Use absolute https:// URLs for images and stylesheets.
- Expecting forms and scripts to work. Scripts are off by default, and forms cannot be submitted from the sandbox. Switch on "Run scripts" for inline JavaScript.
- Styles from your site. The preview is isolated from this page, so it only uses styles in your snippet. Add a <style> block or a <link> to a public stylesheet.
Works well with the HTML Viewer
- HTML Formatter: tidy the markup you are previewing.
- HTML to PDF Converter: turn the same HTML into a PDF.
- HTML Entity Encode / Decode: escape code samples before showing them.
- Lorem Ipsum Generator: fill a layout with dummy paragraphs, wrapped in <p> tags.
Frequently asked questions
Can I view an HTML file online?
Yes. Click "Open file" and choose an .html or .htm file (up to 5 MB). It is read in your browser and never uploaded. Images, stylesheets and scripts linked with relative paths do not load, because only the one file is opened: inline them, or link images and stylesheets with absolute https URLs.
Is it safe to preview untrusted HTML?
Yes. The preview runs in a sandboxed iframe with no access to this page, and scripts stay disabled unless you switch them on.
How is this different from the preview panel in my code editor?
Code editors such as VS Code need an extension or a local server to preview HTML. This viewer works in any browser with nothing to install, which helps on a borrowed machine, a phone or when someone sends you a snippet to check.
Why does an external script not load?
The site's security policy blocks scripts from other domains. Inline scripts run when "Run scripts" is on.
Can I preview an HTML email?
Yes. Paste the email HTML to check the layout. Email clients support less CSS than browsers, so test in real clients before sending.
Is my HTML uploaded?
No. The preview is rendered in your browser and nothing is sent to a server.
How do I view an .html file online?
Choose "Open file" or drop the .html file on the editor. It is read in your browser, never uploaded, and the preview shows how a browser renders it. Images and stylesheets load only if they use absolute https:// URLs.
How can I see the HTML code of a web page?
In the browser, press Ctrl+U (Cmd+Option+U on a Mac) or put view-source: before the address to see the page source. Copy it here to render parts of it, and use the HTML Formatter to indent it so it is easier to read.
Can it render .cshtml or other template files?
Only the HTML in them. Razor (.cshtml), PHP, JSX and other templates are processed on a server first, so directives such as @model or <?php ?> appear as plain text in the preview. Paste the HTML the server produces to see the real page.
How do I preview HTML with CSS and JavaScript together?
Put everything in one snippet: a <style> block in the head for CSS and a <script> block before </body> for JavaScript, then switch on "Run scripts". External stylesheets work when you link a public https:// URL.
How do I convert the HTML I preview to a PDF?
Open the HTML to PDF converter, paste the same code and choose the paper size, orientation and margins. It returns a PDF you can download.
What is the difference between an HTML viewer and an HTML editor?
A viewer shows how code renders; an editor is for writing a whole site. This tool does both for snippets: the left side is an editor and the right side is the live preview, but it does not save files or host pages.
Why does my HTML look different here than in my browser?
The preview has no base URL and loads no styles from your site, so relative images, linked stylesheets and fonts do not appear. Use absolute https:// URLs, or inline the CSS.
Does the HTML viewer work on mobile?
Yes. On a phone the editor and the preview stack vertically, and the preview updates a moment after you stop typing.
Guides and tutorials
- Web Development
How to View and Preview HTML Online: Snippets, Files and Email Templates
View HTML online: paste code to render a live preview, open an .html file, check an email template, and fix blank or unstyled previews. No upload or install.
· 4 min read
- Web Development
How to Preview HTML Code Online Safely: Sandboxed iframes Explained
Preview and render HTML code without risk: how sandboxed iframes, srcdoc and CSP isolate untrusted markup, why scripts stay off, and fixes for broken previews.
· 6 min read
- Web Development
How to Make an HTML Email Signature That Works in Gmail and Outlook
Build an email signature that looks right everywhere: tables, inline styles, hosted images, dark mode, Gmail's size limit and install steps for each client.
· 6 min read
- Web Development
HTML Meta Tags That Matter for SEO and Social Sharing
The meta tags every page needs: title, description, canonical, robots, viewport, Open Graph and Twitter Cards, with lengths, examples and tags to skip.
· 6 min read
Related tools
JSON Viewer
View JSON online as a collapsible tree with value types, item counts and copyable paths. Explore large API responses without scrolling through raw text.
Mermaid Editor
Write Mermaid diagrams online with a live preview: flowcharts, sequence, class, ER, state and Gantt diagrams. Export SVG or PNG and share a link.
Markdown Viewer
Preview GitHub-flavoured Markdown online as you type, with sanitised HTML output. Check READMEs, docs and notes before you publish them.
JSONPath Tester
Test JSONPath expressions online against your JSON with live results. Supports filters, wildcards, recursive descent, slices and unions, and with each match’s path.
JSON Formatter
Format and beautify JSON with configurable indentation and optional key sorting. Errors are reported with exact line and column.
HTML Formatter
Format and beautify messy or minified HTML into clean, indented markup with Prettier, including embedded CSS and JavaScript. Runs locally in your browser.