You are offline. Tools you have opened before keep working.
HTML formatter
Turn messy or minified HTML into clean, indented markup. Block elements get their own lines, short inline content stays together and embedded CSS and JavaScript are formatted as well.
Free and private. Everything runs in your browser, nothing is uploaded.
HTML
HTML
Report a problem
How it works
Paste your HTMLPaste the code, type it or open a file. Try Sample to see an example.
Check the resultThe result appears on the right as you type. Errors are shown with the line and column.
Copy or downloadCopy the HTML with one click or download it as a file.
Formatting that respects HTML
Not every tag deserves its own line. Links, bold text and images inside a paragraph stay in the flow of the text, while divs, lists and tables are indented as blocks. Optional closing tags such as li and td are understood, so pages written without them are formatted correctly.
Content of pre and textarea is never touched, because spaces there are visible on the page.
About HTML
HTML describes the structure of web pages. The formatter knows which tags are blocks and which are inline, keeps pre and textarea content exactly as it is and formats scripts and styles inside the page too.
Frequently asked questions
Will formatting change how my page looks?
In almost all cases no. Spaces between block elements are invisible in HTML. Text inside pre and textarea is kept exactly as written.
Is my code uploaded anywhere?
No. Formatting and minifying run in your browser. Your code is not sent to our servers.
Does minifying rename my variables?
No. Minifying removes comments, line breaks and spaces only. Names stay readable and the code behaves exactly the same, which makes it safe for any file.
Why are some line breaks kept in minified JavaScript?
JavaScript treats some line breaks as the end of a statement. Where removing one could change what the code does, it is kept.
Can I format JSON here?
JSON has its own tool with a tree view and validation. Use the JSON Tools page linked below.
Does it work offline?
Yes. After you open the page once, it keeps working without an internet connection.