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
- Paste an HTML snippet or complete document into HTML input; the preview updates as you type.
- Include CSS in a <style> block or in element style attributes. Wrap standalone CSS in <style> tags and add the HTML it should style.
- Compare the code with the matching-height preview. Check colours, spacing, typography, and layout as you edit.
- 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.
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.