Text Tools

HTML Renderer

Written guide included

HTML Renderer is a free online tool for previewing HTML and CSS in your browser. Paste a snippet or complete HTML document with inline styles or <style> blocks to see a live preview. The HTML input and preview have matching heights, and JavaScript is disabled in the sandbox.

Render HTML with inline CSS and style blocks in a live, sandboxed preview. Edit snippets or complete documents with scripts disabled.

Start here Paste an HTML snippet or complete document into HTML input; the preview updates as you type.

Rendered preview

The preview is sandboxed and scripts are disabled for safety.

Understand the format

How HTML Renderer works

HTML Renderer is a free online tool for previewing HTML and CSS in your browser. Paste a snippet or complete HTML document with inline styles or <style> blocks to see a live preview. The HTML input and preview have matching heights, and JavaScript is disabled in the sandbox.

How the sandbox works

The HTML document and its CSS are placed in an iframe using the srcdoc attribute with a fully restrictive sandbox. Inline style attributes and <style> blocks are preserved. Scripts do not run, forms cannot submit, and the frame cannot access or navigate the surrounding page.

JavaScript-driven content will not run. The sandbox does not block every network request: images, stylesheets, and fonts referenced in pasted HTML or CSS may contact external servers.

What a preview can and cannot tell you

The preview shows how the browser lays out HTML and CSS, including colours, spacing, typography, Flexbox, and Grid. It is useful for checking content fragments and small layouts, but the browser can repair malformed markup, so appearance alone does not validate your HTML.

The preview does not inherit your application stylesheets or run framework hydration. Referenced external assets may load if their URLs are reachable and browser policies permit them. Media queries use the preview frame width. Confirm the final appearance in your application before shipping.

Step by step

How to use HTML Renderer

  1. Paste an HTML snippet or complete document into HTML input; the preview updates as you type.
  2. Include CSS in a <style> block or in element style attributes. Wrap standalone CSS in <style> tags and add the HTML it should style.
  3. Compare the code with the matching-height preview. Check colours, spacing, typography, and layout as you edit.
  4. For external assets, use absolute HTTPS URLs and check that they load. Verify accessibility basics such as image alt text and form labels.

Markup is rendered locally inside a sandboxed iframe and is not uploaded to our servers. Scripts and form submissions are blocked. External assets referenced in HTML or CSS may make network requests.

Worked examples

HTML Renderer examples explained

Reviewing a CMS content fragment

Input

<h2>Release notes</h2><ul><li>Fixed export</li><li>New filters</li></ul>

Result

A heading followed by a two-item bulleted list

Renders the semantic structure that assistive technology will announce, before the site stylesheet changes its appearance.

Previewing HTML with a CSS style block

Input

<style>.card { background: #eef2ff; color: #312e81; padding: 24px; border-radius: 12px; }</style><article class="card"><h2>CSS preview</h2><p style="font-weight: 700">Inline styles work too.</p></article>

Result

A pale card with rounded corners, dark text, and a bold paragraph

The style block targets the card class, while the inline style makes the paragraph bold. Both are rendered inside the sandbox.

A script that does not execute

Input

<p>Hello</p><script>alert(1)</script>

Result

Only the paragraph is rendered

The sandbox blocks script execution, which is what makes it safe to preview markup from an untrusted source.

Reference

What renders in the sandboxed preview

What renders in the sandboxed preview
FeatureWorks hereWhy
Semantic markup and textYesParsed and laid out by the browser as normal.
Inline style attributesYesApplied directly to the elements.
Inline style blocksYesCSS inside the document is honoured.
CSS Grid and FlexboxYesSupported CSS is laid out by your browser.
External stylesheetsDependsLinked CSS can load when its URL and browser policies allow it.
JavaScriptNoBlocked by the sandbox attribute.
Form submissionNoBlocked, so a snippet cannot post data anywhere.
External images and fontsDependsRemote requests may be blocked by the frame origin or by the network.

Practical Guide

How teams use HTML Renderer

Common use cases

  • Test content fragments coming from CMS fields, email templates, or documentation systems.
  • Review copied markup for broken nesting or a missing wrapper element.
  • Validate a small presentational change before editing an application template.

Checks before trusting the result

  • Scripts are disabled, so this is a markup review rather than a behavioural test.
  • External assets may need a real environment to render exactly as production does.
  • Treat pasted HTML from untrusted sources as data to inspect, never as code to run elsewhere.

Troubleshooting

Common mistakes and how to fix them

Expecting a JavaScript-driven component to work in the preview.
It never will. Test interactive behaviour in a development build of the real application.
Assuming the preview reflects production styling.
The preview does not inherit your site styles. Include the CSS in a <style> block, use inline styles, or link a reachable stylesheet with an absolute URL.
Pasting user-generated HTML into an application after previewing it here.
A safe preview is not a sanitiser. Sanitise on the server with a maintained library before storing or rendering it.

FAQ

HTML Renderer questions, answered

Does HTML Renderer support CSS?

Yes. HTML Renderer preserves inline style attributes and <style> blocks, including CSS for colours, fonts, spacing, Grid, and Flexbox. Add the CSS and the HTML it styles to the same HTML input field.

Why is my CSS not showing in the HTML preview?

Wrap standalone CSS in <style> tags or use a style attribute. Check that selectors match your HTML and the CSS is valid. For linked stylesheets, use a reachable absolute HTTPS URL. Styles from your application are not inherited, and JavaScript-based CSS frameworks will not run.

Can I use an external CSS stylesheet?

Yes, you can include a <link rel="stylesheet" href="https://example.com/styles.css"> element. Loading depends on network access and browser policies. For a self-contained preview, copy the required CSS into a <style> block instead.

Is it safe to preview HTML from an unknown source?

The preview uses a restrictive sandbox that blocks scripts, form submission, and access to the surrounding page. Referenced images, CSS, and fonts may still make network requests. Previewing HTML does not sanitise it for publication on another site.

Why does my JavaScript not run?

By design. The sandbox attribute is applied with no allow-scripts token, which is what makes previewing untrusted markup safe.

Can I preview a complete HTML document?

Yes. A full document including head and body renders correctly, as do inline style blocks within it.

Why do my images not appear?

Remote assets may be blocked by the sandboxed frame origin or unavailable from your network. Use a data URI, or check in a real environment.

Does the markup get uploaded anywhere?

The tool renders your markup locally in your browser and does not upload it to our servers. External resources referenced by the document can make requests to their hosting servers.

Go deeper

Specifications and guides