Skip to content
codinganthem
All tools/Formatters/HTML Formatter

HTML Formatter

Format and beautify HTML markup online with proper indentation, instantly. Free HTML formatter for inspecting page source and email templates.

More
Buy me a coffee

How to format HTML online

Paste minified or messy HTML, choose Beautify, and pick 2 or 4 spaces of indentation. The formatted markup appears with syntax highlighting, ready to copy or download as an HTML file. Choose Minify to go the other way.

<ul><li>One</li><li>Two</li></ul>

→

<ul>
  <li>One</li>
  <li>Two</li>
</ul>

Beautify or minify

  • Beautify adds line breaks and indentation so you can read the structure: page source from view-source, HTML email templates, CMS or framework output, and markup copied from a bug report.
  • Minify removes comments and the whitespace between tags to make the file smaller.
  • The minifier is a simple whitespace remover. It also collapses runs of spaces inside <pre>, <textarea> and inline scripts, so don't minify markup where that spacing matters.
  • Beautifying adds line breaks between tags. Between inline elements, such as two links side by side, a line break can show as a space, so check spacing-sensitive layouts after formatting.

Related tools

To show HTML as text, escape it with HTML Entities. To write content in Markdown and see it rendered, use Markdown Preview.

Frequently asked questions

How do I format HTML online?+

Paste the HTML into the input, choose Beautify and an indent size, then copy or download the result. It formats as you type.

Does formatting change how my page looks?+

Usually not, because browsers ignore most whitespace between tags. Line breaks between inline elements can show as spaces, and minifying changes spacing inside pre and textarea.

Does it fix invalid HTML?+

No. It re-indents what you paste but doesn't add missing closing tags or check the markup against the HTML standard.

Is my HTML uploaded?+

No. Formatting runs in your browser, so the markup stays on your device.