HTML Formatter
Paste HTML and choose an indent and a line width. The tool rearranges tags and line breaks but never changes text, attribute values or the contents of pre and textarea. If the markup cannot be formatted safely, your original text is shown with a note. Nothing leaves your browser.
HTML Formatter runs entirely in your browser: the text you paste is never sent to a server. It is free and needs no sign-up.
How to use it
- Paste your HTML In the HTML Formatter, paste HTML into the input, up to 1,000,000 characters. The result below updates as you type, and it is shown as plain text, never rendered as a page.
- Choose indent and width Pick an indent of 2 spaces, 4 spaces or a tab, and a line width of No limit, 80 or 120 characters. Formatting only changes spacing, and if anything else would change, your original text is kept.
- Copy or download Press Copy to copy the result, or Download .html to save formatted.html. If a quoted attribute value or comment is not closed, your input stays as written and the line and column appear.
Questions
Does formatting change the contents of pre and textarea?
No. Content inside pre and textarea elements is kept exactly as written, including its spaces and line breaks, because changing it would change how the page looks. The rest of the HTML is only re-indented.
Does this tool minify HTML?
No. This tool only formats HTML and never removes comments, quotes or tags. Keeping the markup unchanged is deliberate, because aggressive minification can change how a page behaves.
Is it safe to paste HTML from another website here?
Yes. The formatter never runs scripts and never loads images, styles or links, because the result is shown as text. Everything runs in your browser and nothing is uploaded. Input longer than 1,000,000 characters is refused and stays as written.