Re-indent messy or minified HTML so the structure is readable again. Fast, free, and built for simple browser-based workflows.
Paste your HTML above, then click Format HTML.
728 x 90 In-Content Ad
HTML Formatter is a free online tool that re-indents messy or minified markup so its structure is readable again. Paste the HTML, choose an indent size, and every tag is placed on its own line at the depth where it actually sits -- nothing to install and no build step to run.
It earns its keep when markup arrives unreadable: a minified page you need to inspect, an email template pasted out of a CMS as one endless line, a snippet copied from a browser's View Source, or a colleague's file with three different indent styles in it. Nesting you cannot see is how a stray closing tag survives review for a week.
Everything runs inside your browser and your markup is never uploaded to a server. That matters when the file is a client's landing page, an unreleased template, or anything with internal URLs sitting in a script tag. The formatted result stays on your device unless you choose to copy or download it.
Drop messy or minified markup into the Unformatted HTML box. Anything from a single snippet to a full page works.
Choose 2 spaces, 4 spaces, or Tab from the Indent Size menu so the output matches the file you are pasting it back into.
Click Format HTML. Each tag moves onto its own line at its nesting depth, and the line count appears above the result.
Click Copy for the clipboard, or Download to save the markup as formatted.html. Clear empties both boxes.
Yes! All our tools are 100% free to use with no hidden costs, no registration required, and no credit card needed.
Absolutely. All tools run entirely in your browser (client-side). Your data never leaves your device and is not sent to our servers.
Yes, once the page is loaded, the tool will continue to work even if you lose internet connection since it runs in your browser.
There is no strict character limit, but very large amounts of text (100,000+ characters) may slow down your browser.
Yes! All our tools are free for both personal and commercial use.
In almost every case, no. Indentation is whitespace between tags, and browsers collapse it. The exceptions are inline elements where a single space is visible, and the contents of pre, textarea, script and style -- which this tool deliberately leaves exactly as it found them.
Two spaces is the usual default for HTML and stops deeply nested markup drifting off the right edge of the screen. Pick 4 spaces or Tab when the project you are pasting into already uses them, so the file stays consistent with the code around it.
Because whitespace inside pre, textarea, script and style is meaningful -- re-indenting it would change what the visitor sees or break the code. The formatter spots those four elements, copies their contents through untouched, and resumes indenting after the closing tag.
No. It formats markup, it does not validate or fix it. An unclosed tag leaves everything after it indented one level deeper than expected, which is often the fastest way to spot where the missing tag belongs -- but you still add it yourself.
Yes, and it is the most common reason to use it. Paste the single-line source from View Source or your browser's DevTools, click Format HTML, and every tag lands on its own line at the right depth so you can read how the page is built.
Partly. Anything opening with a doctype or a PHP tag is placed on its own line without changing the indent level, so those survive intact. Curly-brace template syntax is treated as ordinary text and passes through unchanged, though it will not affect indentation either.