HTML Formatter
Beautify and indent messy or minified HTML in your browser.
Examples
Beautify minified HTML
Input
<ul><li>One</li><li>Two</li></ul>
Output
<ul> <li>One</li> <li>Two</li> </ul>
Indent a nested structure
Input
<div><p>Hi <a href="#">there</a></p></div>
Output
<div> <p>Hi <a href="#">there</a></p> </div>
About this tool
This free online HTML formatter turns messy, minified, or hand-edited markup into clean, neatly indented HTML — a fast HTML beautifier and pretty-print tool. Paste your HTML, choose an indentation style, and the formatted result appears instantly. Everything runs in your browser with no upload, so your code never leaves your device.
How to use
- Paste your HTML into the input box (or click Sample to try it).
- Pick an indent of 2 spaces, 4 spaces, or a tab.
- Read the beautified HTML in the output box on the right.
- Copy the result with the Copy button.
When to use an HTML formatter
Reformatting is handy when you copy compressed HTML from a built page, inherit inconsistent markup from a teammate, or want to read an email template or component before editing it. A consistent indent makes nesting obvious and diffs cleaner.
Frequently asked questions
Is this HTML formatter free?
Yes — it's a completely free online HTML formatter and beautifier with no sign-up and no limits. Format and indent as much HTML as you like.
Is my HTML uploaded to a server?
No. This is a no-upload tool — your HTML is formatted entirely in your browser, so the markup never leaves your device. It's safe for private or internal code.
What does the HTML beautifier actually do?
It re-indents your markup, puts tags and content on their own lines, and normalizes spacing so messy or minified HTML becomes clean and readable. It does not change what the page renders.
Can I choose the indentation?
Yes — pick 2 spaces, 4 spaces, or tabs. Your choice is remembered in your browser for next time.
Does it work with minified HTML?
Yes. Paste single-line or minified HTML and it expands it back into a properly indented, readable structure.
Will it break my inline JavaScript or CSS?
No. Inline <style> and <script> blocks are kept intact and indented along with the surrounding markup, so your code keeps working.
Does it work offline and on mobile?
Once the page has loaded it runs locally, so it keeps working on a flaky connection, and the layout is fully responsive on phones and tablets.
Learn more
Related tools
JSON Formatter
Format, validate, and beautify JSON instantly in your browser.
CSS Formatter
Beautify and tidy messy or minified CSS in your browser.
JavaScript Formatter
Beautify and indent minified or messy JavaScript in your browser.
SQL Formatter
Format and beautify SQL queries with uppercased keywords.