Free online tool

HTML Formatter

Make HTML readable with consistent indentation, or compress it by removing extra whitespace and comments. Everything runs in your browser. Your files and text are not uploaded to our servers.

Use the tool

Loading the tool...

How to use it

  1. Paste your HTML.
  2. Choose the indentation.
  3. Select Format to beautify or Minify to compress.
  4. Copy the result.

Tips for best results

  • Contents of <pre>, <textarea>, <script> and <style> are kept as written.
  • This is a formatter, not a validator. It will not fix unclosed tags.

Frequently asked questions

Does it change how the page looks?

Formatting only changes whitespace between tags. Rendering normally stays the same.

Can it fix broken HTML?

No. It re-indents what you give it. Use a validator to find structural errors.

← Back to Developer Tools