HTML Formatter & Minifier
Beautify messy or minified HTML into clean, indented markup, or compress it for production. Void tags stay on one line and the contents of <pre>, <script> and <style> are preserved exactly.
About the HTML formatter
Bytewrench's HTML formatter indents your markup into a clean, readable tree — nesting each element, keeping void tags like <img> and <br> on a single line, and leaving the contents of <pre>, <textarea>, <script> and <style> untouched so whitespace-sensitive content stays correct. Switch to minify to strip comments and collapse whitespace for production.
It's handy for tidying up scraped or generated HTML, email templates and snippets. Everything runs in your browser.
Indent nested markup with 2/4-space or tab, or compress to a single line.
Leaves <pre>, <textarea>, <script> and <style> contents exactly as written.
Self-closing and void elements like <img>, <br> and <meta> don't add bogus indentation.
Markup is formatted in the browser and never uploaded.
Frequently asked questions
Will formatting change how my page renders?
Beautifying only adds indentation whitespace between block-level tags, which browsers ignore. Content inside <pre> and <textarea> is preserved, so rendering is unchanged in practice.
Does it preserve my JavaScript and CSS?
Yes. The contents of <script> and <style> are kept verbatim — the formatter only reindents the surrounding HTML structure.
Does minify remove comments?
Yes. Minify strips HTML comments and collapses whitespace between tags while preserving whitespace-sensitive elements like <pre>.
Is my HTML uploaded anywhere?
No. All formatting happens locally in your browser.