Beautify messy HTML with proper indentation, or minify it by removing comments and the whitespace between tags. Content inside <pre>, <textarea>, <script> and <style> is left untouched. Everything runs in your browser.
Input HTML
<!DOCTYPE html>
<html lang="en"><head><title>Hello</title></head>
<body><!-- main -->
<div class="container"><h1>Hello, world</h1><p>A <strong>sample</strong> page.</p>
<ul><li>One</li><li>Two</li></ul></div></body></html>Beautified
<!DOCTYPE html>
<html lang="en">
<head>
<title>Hello</title>
</head>
<body><!-- main -->
<div class="container">
<h1>Hello, world</h1>
<p>A <strong>sample</strong> page.</p>
<ul>
<li>One</li>
<li>Two</li>
</ul>
</div>
</body>
</html>Same input
<!DOCTYPE html>
<html lang="en"><head><title>Hello</title></head>
<body><!-- main -->
<div class="container"><h1>Hello, world</h1><p>A <strong>sample</strong> page.</p>
<ul><li>One</li><li>Two</li></ul></div></body></html>Minified
<!DOCTYPE html><html lang="en"><head><title>Hello</title></head><body><div class="container"><h1>Hello, world</h1><p>A <strong>sample</strong> page.</p><ul><li>One</li><li>Two</li></ul></div></body></html>Escape special characters with HTML Entities, preview formatted text with the Markdown preview, or minify CSS and JavaScript.
Paste your HTML and choose Beautify. Tags are indented by nesting depth and long lines are wrapped, making minified or copy-pasted markup easy to read.
Minify removes comments and the whitespace between tags. Content inside <pre>, <textarea>, <script> and <style> is left untouched so behaviour doesn't change.
Beautifying only changes whitespace. Minifying can remove whitespace between inline elements, which in rare cases changes spacing, so test the result. Everything runs in your browser — your code is never uploaded to a server.