HTML Minifier & Beautifier
Format HTML or compress it in your browser. Contents of script, style, pre and textarea are left untouched.
What it is for?What it is for?
Paste a page, a template or an email snippet. Beautify puts block elements on their own lines and indents them with four spaces, which helps when markup arrives on one long line from a CMS or a build tool. Compress does the opposite before you ship static HTML.
What is preserved
Compressing removes comments and the whitespace between tags. Text inside script, style, pre and textarea is copied as-is, because collapsing it can change how the page runs or how preformatted text looks.
Conditional comments for old Internet Explorer, the ones that start with [if, are kept because some email templates still rely on them.
Watch the spaces between tags
Compress drops whitespace that sits alone between two tags. Between block elements that never matters. Between inline elements it can: two links separated only by a space will touch after compression. If you need that gap, keep it inside the text or write it as an entity.
Beautify keeps inline elements such as a, span, strong and code on the same line as the surrounding text, so sentences are not broken up. Runs of whitespace inside text are collapsed to a single space.
Not a validator
The tool does not check that tags are closed or nested correctly. Broken markup comes out formatted but still broken, and the indentation may drift where a closing tag is missing.
It stays in the browser
Both buttons work in this tab. The HTML is not uploaded.