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.
Processed in your browser. Nothing you paste is sent to a server.
How to use this tool
- Paste HTML or open a file.
- Choose format or minify.
- 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.