HTML Formatter
Beautify messy or minified HTML with clean indentation. Indent 2, 4 or 8 spaces, line wrapping, inline scripts and styles indented too.
Beautify messy or minified HTML with clean indentation. Indent 2, 4 or 8 spaces, line wrapping, inline scripts and styles indented too.
Used HTML Formatter? Share how it went to help others.
About this tool
HTML Formatter makes HTML readable again. Code copied from a website, written by a page builder or squeezed onto one line by a minifier is hard to read and harder to change. Paste it, press Format, and every element gets its own line with clear indentation, so you see at once which parts belong together. You choose an indent of 2, 4 or 8 spaces, and whether long lines are wrapped at 80 or 120 characters or left as they are. Empty lines that you placed on purpose are kept, but at most one in a row, so the result stays compact. A blank line is added before the head and the body and after the end of the document, which makes the main parts easy to find. The formatter knows HTML. Text inside pre blocks and text areas is left exactly as it was, because spaces and line breaks there change what is shown. Inline elements such as links, bold text and spans stay inside their sentence, so text is not split into many lines. Code in script and style blocks is indented as JavaScript and CSS, so a whole page becomes readable, not only its tags. When you change the indent or the wrapping, the result is formatted again at once. Copy the result with one button, and use the full screen view for long documents. The formatter does not change what your page does. It only adds and removes spaces and line breaks between tags. It is not a validator: missing closing tags are not reported, and broken HTML is indented as well as possible. To find errors, use the HTML Validator. To make a file small again for a live site, use the HTML Minifier. Everything runs in your browser. Your code is not uploaded, which matters for pages that contain private data or keys.

Messy or minified.
2, 4 or 8 spaces.
Clean, indented code.
Ready to edit.
One element per line, clearly indented.
2, 4 or 8 spaces.
At 80 or 120 characters, or none.
Preformatted text is left as it is.
Make code readable before you change it
Understand a page from a website.
ExampleIndent 2, no wrapping.
Clean up an email or theme template.
ExampleIndent 4, wrap at 120.
Tidy code exported from a builder.
ExampleThen remove unused parts.
Same style before comparing files.
ExampleFormat both with one setting.
See the structure of a newsletter.
ExampleWrap at 80.
See how elements nest.
ExampleIndent 4 for clarity.
Clean code without surprises
Use the same indent as your team, often 2 spaces.
Use full screen to see more lines at once.
The code stays in your browser, but remove keys before sharing it anywhere.
Senior Software Engineer · Developer of Toolyconvert
Hemant developed HTML Formatter and tests it on desktop and mobile with real files. He is a senior software engineer from Dehradun, India, building websites since 2014, and designed and developed Toolyconvert end to end.
Last updated 26 November 2026
Featured on
Toolyconvert is listed on these product directories and launch platforms.