Instantly format and indent messy HTML with Prettier. Handles HTML5, custom elements, and embedded scripts and styles. Live preview, 100% browser-based.
The HTML Formatter is a Prettier-powered, browser-based tool that instantly beautifies and properly indents raw or minified HTML markup. It handles HTML5, custom elements, Web Components, embedded `<script>` and `<style>` blocks, and produces clean output with configurable indentation and print width. A built-in Live Preview tab renders the formatted HTML in a sandboxed iframe so you can confirm the output looks correct without leaving the tool. All formatting runs in a Web Worker — your HTML never leaves the browser.
QWhich formatter powers this tool?
Prettier's HTML parser — the same parser used by VSCode's built-in formatter and most popular IDE extensions.
QDoes it format inline JavaScript and CSS?
Yes — Prettier formats embedded <script> blocks as JavaScript and <style> blocks as CSS, producing consistently indented output throughout the document.
QWhat does the Live Preview tab do?
The Preview tab renders your formatted HTML in a sandboxed iframe with allow-scripts and allow-same-origin permissions. It lets you visually confirm the output before copying.
QIs my HTML sent to a server?
No. All formatting runs locally in a Web Worker inside your browser. Your markup never leaves your device.