HTML formatter and minifier
Tidy HTML into neat, indented markup, or shrink it for your live site.
Paste HTML, open an .html file, or drop one here
Next: CSS formatter & minifier · JavaScript formatter & minifier
Report a problem with this tool
How to use HTML formatter
Paste your HTML
Paste a page or a snippet, or open or drop an .html file. It’s formatted as you type.
Beautify or minify
Beautify indents every tag with 2 or 4 spaces or a tab. Minify strips comments and spaces that don’t show.
Copy or download
Copy the result, or download it as an .html file. When minifying you’ll see how many bytes you saved.
Why use Utils365
Safe minifying
The inside of <pre>, <textarea>, <script> and <style> is never touched, and one space is kept between inline tags, so the page looks the same.
Readable markup
Nested tags get one indent per level, so a page squashed onto one line becomes easy to read and edit.
See the savings
The size before and after, and the percentage saved, appear as soon as you minify.
Private by design
Your HTML is formatted in your browser and never uploaded, so unreleased pages and templates stay with you.
Frequently asked questions
What does an HTML minifier remove?
Comments, line breaks and indentation, and spaces between tags that browsers don’t display. Old Internet Explorer conditional comments are kept because they still do something.
Will minifying change how my page looks?
It shouldn’t. Whitespace next to block elements like <div> and <p> never shows, so it goes. Between inline elements like links and buttons a single space is kept, because there it’s visible.
Are my scripts and styles changed?
No. The content of <script> and <style> stays exactly as written. To shrink those too, run them through the JavaScript and CSS formatters.
Why is <pre> left alone?
Inside <pre> and <textarea> every space and line break is shown on the page, so removing any of them would change what visitors see.
Does the formatter fix broken HTML?
No. It changes only the layout, not your tags. A missing closing tag stays missing, so check the indents: a tag that never ends pushes everything after it one level in.