HTML Formatter & Minifier

Clean up generated or copy-pasted HTML so you can read it, or shrink it before shipping.

✓ Runs locally in your browser — nothing is uploaded

In short: An HTML formatter re-indents markup so nested elements are easy to follow; a minifier removes comments and extra whitespace to make the file smaller.

About HTML Formatter & Minifier

HTML exported from page builders, email editors and CMS previews is often a wall of nested divs on a few huge lines. Beautifying it gives each block element its own line and indents children, so you can find the element you need and see where tags open and close.

Beautify uses the widely used open-source js-beautify engine, which also formats CSS in <style> and JavaScript in <script> blocks. Minify takes a conservative approach: it removes comments and collapses whitespace between tags, but leaves <pre>, <textarea>, <script> and <style> content untouched so the page behaves the same.

How to use HTML Formatter & Minifier

  1. Paste your HTML.
  2. Choose the indent and, optionally, a line-wrap width.
  3. Press Beautify to format or Minify to compress, then copy the result.

Examples

Nested markup

<ul><li>One</li><li>Two</li></ul> becomes a list with each <li> indented on its own line.

Minify a template

A 12 KB email template with comments and indentation typically drops by 15–30% after minifying, with identical rendering.

Frequently asked questions

Does beautifying change how the page looks?

Usually not, but whitespace between inline elements (like two <span>s) can create or remove a visible space. Check spacing-sensitive layouts after formatting.

Does the minifier remove optional tags or attribute quotes?

No. It only removes comments and collapsible whitespace, which is the safe subset. Aggressive minification belongs in a build tool.

Is conditional-comment markup kept?

Yes. Comments starting with <!--[if (used in HTML emails for Outlook) are preserved when minifying.

Is my code uploaded?

No. Everything runs in your browser. You can check this yourself: open your browser’s developer tools, switch to the Network tab and use the tool — no request carries your input.

Updated November 2026 · Free, no signup · How we build and test tools

Related tools All developer tools →