HTML Formatter & Minifier
Beautify HTML with clean indentation or minify it to a single compact line — script, style and pre content preserved — 100% in your browser.
<div class="card">
<!-- greeting -->
<h2>
Hi
</h2>
<p>
Welcome to
<a href="/">
Nifty
</a>
.
</p>
</div>🔒 Processed in your browser — nothing is uploaded. Contents of <pre>, <textarea>, <script> and <style> are preserved.
Beautify or minify
Paste HTML and switch between two modes. Beautify re-indents the markup so every tag and text node sits on its own line, making the document structure easy to read. Minify strips comments and collapses insignificant whitespace into a single compact line to shrink file size. In both modes the raw content of <pre>, <textarea>, <script> and <style> is preserved exactly, so your code and preformatted text are never mangled, and void elements like <br> and <img> are handled without adding stray nesting.
When to use each mode
Use beautify when you have received compressed or single-line HTML and want to read or edit it, or to tidy up markup before committing it. Use minify to reduce the size of a snippet for production or an email template where every byte counts. Because everything runs in your browser, you can paste proprietary markup without it ever being uploaded. Note that minification here is conservative — it focuses on whitespace and comments and never rewrites your tags or attributes.
Frequently asked questions
Does minifying break my inline scripts or styles?
No. The contents of <script>, <style>, <pre> and <textarea> are preserved verbatim in both beautify and minify modes, so code and preformatted text are never altered.
What does beautify do exactly?
It re-indents the HTML so each tag and text node is on its own line with consistent indentation, without changing which tags or attributes are present. You can choose 2 spaces, 4 spaces, or a tab for the indent.
Is my HTML uploaded anywhere?
No. Formatting and minifying run entirely in your browser with JavaScript. Nothing you paste is sent to a server or stored.