How to use
- Type HTML into the HTML box, or click Paste to load it from your clipboard.
- Choose Beautify or Minify under Mode, then adjust Indent, Wrap attributes or the other options if needed.
- Click Format HTML for Beautify or Minify HTML for Minify.
- Click Copy to copy the result, or Download to save it as a file.
Examples
Make a minified product page readable
<!doctype html><html><head><meta charset="utf-8"><title>Shop</title><style>.card{padding:16px;border:1px solid #ddd}</style></head><body><div class="card"><h2>Coffee mug</h2><p>Only <b>$12</b> today.</p><button onclick="buy()">Buy</button></div></body></html><!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Shop</title>
<style>
.card {
padding: 16px;
border: 1px solid #ddd
}
</style>
</head>
<body>
<div class="card">
<h2>Coffee mug</h2>
<p>Only <b>$12</b> today.</p><button onclick="buy()">Buy</button>
</div>
</body>
</html>Put form attributes on separate lines
<input type="email" id="email" name="email" placeholder="you@example.com" class="form-control" autocomplete="email" required>
<input type="email" id="email" name="email" placeholder="you@example.com" class="form-control" autocomplete="email" required>
Remove comments and extra whitespace
<div class="card"> <!-- product --> <h2> Coffee mug </h2> <p>Only <b>$12</b> today.</p> </div>
<div class="card"><h2>Coffee mug</h2><p>Only <b>$12</b> today.</p></div>
FAQ
Is my HTML uploaded or saved?
Formatting and minifying run in your browser without sending your HTML to a server. The formatter does not save your HTML; it saves only your option settings. Site analytics receives tool events, but not your HTML.
Does this tool validate HTML?
It warns about unclosed tags, unmatched closing tags and duplicate attributes, but it is not a full HTML validator. Tags that close implicitly, such as p, li and td, do not trigger unclosed-tag warnings. Click a warning to jump to its input line.
Can I preview the formatted HTML?
Click Open in HTML Viewer to preview the result in the separate viewer. The formatter itself displays HTML only as text, so it does not load images or run scripts from your code.
Why did automatic formatting stop?
Live formatting starts after your first run, or after you use Paste, Upload, Load example or Try this example, and stops when the input exceeds 100 KB. For larger input, use Format HTML or Minify HTML, or press Ctrl+Enter on Windows or Cmd+Enter on Mac.
Are template tags and preformatted text preserved?
Both modes leave {{ }}, {% %} and PHP tag fragments intact. Content inside pre and textarea elements is kept unchanged.