HTML Formatter & Minifier
Paste HTML to indent it neatly so it is easy to read, or minify it to remove comments and extra whitespace and make the page smaller. Inline CSS and JavaScript inside the page can be minified too. Everything runs in your browser, and your code is never uploaded.
0 bytes
How to use it
- Choose Format to make HTML readable, or Minify to make it smaller.
- Paste your HTML into the input box, or press “Load sample” to try it.
- For Format, pick the indentation and, if you like, a line length at which long lines wrap.
- Press the button, then copy the result or download it as a file.
Frequently asked questions
What does an HTML formatter do?
It re-indents the markup so that nested elements line up, puts tags on their own lines and tidies attributes. The page looks and behaves the same. Only the whitespace in the source changes.
What does the HTML minifier remove?
It removes comments and collapses runs of spaces and line breaks, and removes whitespace between block-level tags such as div, p and li. Content inside pre and textarea is left exactly as it is. If you leave the inline option on, the CSS in style tags and the JavaScript in script tags are minified as well.
Will minifying change how my page looks?
It should not. Spaces between inline elements, such as two links side by side, are kept because browsers render them. The tool does not rewrite attributes or remove optional tags, which keeps it safe. Always test the minified page before using it in production.
How much smaller will my HTML get?
It depends on how much whitespace and how many comments the file has. Hand-written, indented HTML often shrinks by 10 to 30 percent. HTML that is already compact shrinks little. Server compression such as gzip saves much more on top of this.
Is my code uploaded anywhere?
No. The formatter and minifier run in your browser.
Related tools
These tools run entirely in your browser and are provided free, without warranty. Check important results before using them in production.