HTML Formatter — Free Online Tool
Pretty-print messy HTML with clean 2 or 4-space indentation — or minify it down for production. Instant, private and free.
How it works
Frequently asked questions
Is my HTML uploaded to a server?
No. Formatting and minifying run entirely in your browser using the js-beautify library, so your code never leaves this page — nothing is uploaded or stored anywhere.
What does Format do exactly?
It pretty-prints your HTML with consistent indentation (2 or 4 spaces, your choice), one element per line, and collapses stray blank lines — works on full documents and on fragments or snippets too.
What does Minify do?
It removes comments and collapses unnecessary whitespace to shrink the file for production. Content inside <pre>, <textarea>, <script> and <style> tags is left untouched so your code keeps working.
js-beautify engine · Format + Minify · 100% local — your code never leaves this page.