HTML Formatter

Reformat minified or messy HTML into clean, indented, readable markup.

Website Management Tools

About the HTML Formatter

The HTML Formatter turns minified or untidy markup into clean, indented code. You can choose your indent size, and it shows the lines before and after along with the number of tags, so you can read a page's structure at a glance.

It is the opposite of minifying. Use it when you have copied code from a page source, received a compressed template, or need to find a missing closing tag. Good indentation shows which element sits inside which.

Small inline tags such as links and bold text stay on one line, so that the text remains readable. The tool formats your code but does not fix invalid HTML, so an unclosed tag will still be unclosed, although it often becomes easier to spot.

How to use this tool

  1. 1Paste your HTML, or load the sample.
  2. 2Choose the indent size.
  3. 3Review the formatted code.
  4. 4Copy it for editing.

Best-practice tips

  • Format first when you are hunting for a layout bug.
  • Minify again before you put a large file back on a live site.
  • Look for indentation that never returns to the left, as this suggests an unclosed tag.

Answers

HTML Formatter FAQs

Normally not, although spaces can matter inside <pre> tags and between inline elements.

Related tools

Continue with these related website management tools.