HTML Formatter

Paste HTML to indent nested elements consistently, or compact it by removing whitespace between tags. Content where whitespace matters is left exactly as it was.

  • Free, no account needed
  • Checked by 3 test cases
  • Runs in your browser: nothing you enter is sent to us
  • Updated November 19, 2026

Processed in your browser. Nothing you paste is sent to a server.

Result

                
            

How to use this tool

  1. Paste HTML or open a file.
  2. Choose format or minify.
  3. Copy or download the result.

How it works

The formatter reads the HTML as a sequence of tags and text without running it. Block-level elements start on a new line and indent their children; inline elements (a, strong, span and similar) stay in the flow of the text. The contents of pre, textarea, script and style are copied unchanged. Minify removes whitespace between tags only.

Limitations

  • The formatter does not fix invalid HTML (unclosed or misnested tags); it indents what is there.
  • Minify does not compress inline CSS or JavaScript.

Privacy and data

Everything happens in your browser. What you paste or open is never sent to our server, logged or stored, and the page works offline once loaded.