An HTML formatter takes messy HTML and lays it out neatly: one tag per line where it makes sense, and every
nested tag indented one step further than its parent. It doesn’t change what your page does or how it looks. It
only changes the spacing, so the code is easy for a human to read.
Why bother? Because you’ll spend way more time reading HTML than writing it. Code copied from a CMS, an email
template or the browser’s “View source” often arrives as one giant line. With proper indentation you can see at
a glance which <div> closes where, spot a tag that’s in the wrong place, and review changes
without squinting. It also keeps a team’s code looking the same, no matter who wrote it.
It works the other way too. Switch to Minify and the tool strips comments and extra
whitespace, so the file is smaller when you ship it. Everything runs in your browser and your code is never
uploaded.
How to Use It – Step by Step
Five short steps. Paste the examples into the tool above and watch what happens.
Step 1 Paste or Open Your HTML
Get your code into the left panel. Pick whichever is easiest:
Paste it: copy HTML from your editor, a CMS, an email or a web page’s source, and paste it in.
Open a file: click the upload button, or drag an .html file onto the tool.
Click Sample: loads a small, messy page so you can see the formatter in action right away.
There’s no Format button to hunt for. The right panel updates a moment after you stop typing.
Try it: one long line becomes readable
Before:
<divclass="card"><h2>Coffee</h2><p>Fresh, <b>hot</b> and strong.</p><ul><li>Small</li><li>Large</li></ul></div>
After (2 spaces):
<divclass="card"><h2>Coffee</h2><p>Fresh, <b>hot</b> and strong.</p><ul><li>Small</li><li>Large</li></ul></div>
💡 See how <b>hot</b> stayed inside its sentence? Inline tags stay on the same line as
their text, so the formatter never adds spaces your visitors would see.
Step 2 Pick Your Indent
Use the indent menu above the output to choose 2 spaces, 4 spaces or
Tab. Two spaces is the most common for HTML. If your project already has a style, match it.
Long paragraphs can run far off the right side of your screen. Set Wrap to 80 or 120 and
the formatter breaks lines that are longer than that. It only breaks at spaces, so the text still renders
exactly the same. Leave it on Off if you’d rather keep each paragraph on one line.
Try it: wrap at 80 characters
Before:
<p>HTML formatters keep inline tags like <ahref="/docs">links</a> on the same line as their text, so long paragraphs can get really wide.</p>
After (wrap at 80):
<p>HTML formatters keep inline tags like <ahref="/docs">links</a> on the same
line as their text, so long paragraphs can get really wide.</p>
Step 4 Keep Your Blank Lines
By default the output has no empty lines. If you use blank lines to separate sections of your page, tick
Keep blank lines. Where you had one or more empty lines, you’ll get exactly one.
Switch the toggle to Minify when you want the smallest file. Comments go away and so does
the whitespace between tags. A single space stays wherever the browser would show one, and the inside of
<pre>, <textarea>, <script> and
<style> is left alone. The status bar shows how much smaller the file got.
Try it: minify a menu
Before (153 bytes):
<!-- Main menu --><ulclass="menu"><li><ahref="/">Home</a></li><li><ahref="/blog">Blog</a></li></ul><p>Made with <b>love</b> and coffee.</p>
After (124 bytes, 19% smaller):
<ulclass="menu"><li><ahref="/">Home</a></li><li><ahref="/blog">Blog</a></li></ul><p>Made with <b>love</b> and coffee.</p>
Copy: puts the result on your clipboard in one click.
Download: saves the result as an .html file.
Next step: paste the result into the HTML Viewer to see the page, or
into the HTML Editor to keep working on it with CSS and JavaScript.
💡 A formatter fixes spacing, not mistakes. If a tag is missing or misspelled, the indentation usually looks
“off” around it, which is a great clue. For a full list of errors, run your code through the
HTML Validator.
Frequently Asked Questions
Will formatting change how my page looks?
No. Format only adds line breaks and indentation where the browser ignores them, like between a </li> and the next <li>. Inline bits such as <b> and <a> stay on the same line as their text, and anything inside <pre> or <textarea> is left exactly as it was. Minify is careful too, with one thing to know: if your CSS turns block elements into inline-block (for example a row of <li> menu items), the small gap the line breaks used to create between them can disappear.
Should I use tabs or spaces?
Whatever your team already uses. Two spaces is the most common choice for HTML because nested tags add up fast. Four spaces is easier to scan if your markup is shallow. Tabs let everyone pick their own width in their editor. The important part is being consistent within a project.
What is the difference between Format and Minify?
Format is for people: it puts each block tag on its own line and indents it, so you can read and edit the code. Minify is for browsers: it removes comments and the whitespace the browser doesn’t need, so the file is smaller. Format while you work, and minify the copy you ship if your build tools don’t already do it.
Is my HTML uploaded anywhere?
No. The formatting and minifying happen right here in your browser. Your code never leaves your computer, so it’s fine to paste private or work code.
Does it fix broken HTML?
No. A formatter only changes spacing and indentation, it doesn’t close missing tags or fix typos. The good news is that clean indentation makes those mistakes much easier to spot. To find them for you, run your code through the HTML Validator, or let the HTML Fixer repair them.
Why are comments gone after I click Minify?
Removing comments is part of minifying, since browsers skip them anyway. Old Internet Explorer conditional comments like <!--[if IE]> are kept because they can change what the page does. Switch back to Format and your comments are still there, because the original code on the left is never changed.
How much HTML can I paste?
Up to 5 MB, which is far bigger than almost any real page. Small files update instantly as you type. Very big ones (a megabyte or more) take a second or two, so the tool waits a little longer after you stop typing before it reformats.