HTML Beautifier

Format messy or minified HTML with clean indentation.

What is an HTML beautifier?

An HTML beautifier rewrites HTML code with consistent indentation and line breaks so its structure is easy to read and edit, without changing what the page displays.

What it does

  • Indents nested elements consistently (2 spaces, 4 spaces or tabs).
  • Puts block elements on their own lines and keeps inline elements such as <b> and <a> inline.
  • Formats inline <style> and <script> content.
  • Keeps the content of <pre> and <textarea> exactly as it is.

It uses js-beautify, the same formatter used by many code editors. Use it to read minified page source, clean up exported HTML from page builders or prepare code for review.

Going the other way? The HTML Minifier removes whitespace for production.

Frequently asked questions

Will beautifying change how my page looks?

Normally no. In rare layouts that depend on spaces between inline elements, check the result.

Does it fix invalid HTML?

It formats what is there but does not repair broken markup.

Is my code uploaded?

No, formatting happens in your browser.