HTML Formatter

Beautify messy or minified HTML with consistent indentation; embedded CSS and JavaScript are formatted too.

Runs in your browser. Your input is processed on your device and is not uploaded to our server.

How to use the HTML Formatter

  1. Paste your code or open a file.
  2. Choose the indentation and click Format.
  3. Check the result and the size change, then copy or download it.

The formatter tokenises your HTML and re-indents nested elements. Content of <pre> and <textarea> is preserved exactly; <style> and <script> blocks are formatted with the CSS and JavaScript formatters. Formatting only changes whitespace between tags, which can occasionally affect inline layout where spaces are significant.

Frequently asked questions

Does it fix invalid HTML?
No. It re-indents what you give it. Use the W3C validator to find markup errors.
Is my code uploaded?
No. Formatting happens in your browser.