Compress HTML
Strip the whitespace a browser does not need, and see what you saved.
What you type is processed in your browser and never sent to us.
How to do it
-
Paste your HTML
A fragment or a whole page.
-
Decide about comments
Remove them or keep them.
-
Copy the result
The saving is shown underneath.
What this is for
Markup written for people to read carries indentation and blank lines that a browser has no use for. Removing them makes the file smaller without changing what it renders.
Content inside pre and textarea is left alone, because there whitespace is part of the meaning.
Common questions
Whitespace between inline elements is significant, so it is preserved. Blocks are safe to collapse.
Usually not – a build step is the right place. This is for the one-off case.
For websites the server does it better, through compression. This tool is for one-off cases: templates, embedded blocks, fields with a length limit.
Missing a tool? Tell us which one.