Send feedback

Coming from the page: HTML Formatter

One moment…

Prettier engineInline CSS & JS tooNothing uploaded

HTML Formatter

Turn minified or messy HTML into clean, readable code.

Everything runs in your browser: your code and files are never uploaded.

How to format HTML

1

Paste the code

Paste your HTML or open a file, or try “Example”.

2

Choose the indent

2 spaces, 4 spaces or Tab, and the line width.

3

Copy or download

Press “Format”, then copy or download the result.

Options

OptionValuesMost common
Indent2 spaces, 4 spaces, Tab2 spaces in most web projects
Line width80, 100 or 120 characters80; longer lines are wrapped

Tips

The page looks the same. Prettier knows where whitespace matters (like <b> and <a>), so it breaks lines without adding visible spaces. That’s why you may see a > at the start of a line; it’s on purpose.

Inline CSS and JavaScript. Code inside <style> and <script> is formatted too, with each language’s rules.

Unclosed tags? If the code has a clear error, you get the line, column and reason.

Your code stays private: The tool runs entirely in your browser, so your code and files are never sent to any server, and it keeps working offline once the page is open.

FAQ

What’s the difference between formatting and minifying HTML?

Formatting adds line breaks and indentation so code is easy to read and edit; minifying removes them to make the file smaller for upload. Use the HTML Minifier for the opposite.

Does formatting change the page content?

No. We tested it on dozens of real pages, comparing the elements and text before and after with an independent HTML parser (html5lib): they matched.

Which engine does it use?

Prettier 3.9 (MIT), the most popular code formatter among web developers, running here in your browser.

Can I unminify a minified HTML page?

Yes, paste the minified page and you get clean code. Removed comments don’t come back, of course.