Reduce HTML size by compressing whitespace and removing comments. Keep an editable source version for later changes.
How to use
Paste the HTML and run the minifier. Check the result in your page, especially spaces between inline elements, before deployment.
Example
A block containing indented tags loses much of its indentation. Inline text still needs a visual check to confirm intended spacing.
FAQ
Are embedded scripts and styles compressed?
No. JavaScript and CSS content is preserved. Use the separate minifiers when you need to process those languages.
Related tools
A practical task
Before replacing a page template, compare text around inline elements. Whitespace near links or emphasis can separate words intentionally. Check the output in the same page state and viewport, then keep the readable template as the editing source.
Another useful question
Does the result remove private information in comments reliably?
Do not use minification as a privacy process. Remove secrets from the source and delivery pipeline instead of depending on a compacting step.
Details for interpreting the result
| Detail | Explanation |
|---|---|
| HTML and plain text | HTML tags describe structure. Plain text displays characters without interpreting them as tags. Decide which result you need before removing markup, escaping brackets, or pasting output into an editor. |
| Formatting and behavior | A formatter changes presentation of source code. It does not prove that a program calculates the right value or that a page looks correct. Keep behavior checks separate from indentation and spacing checks. |
| HTML character references | Character references such as & describe a character inside HTML. A reference can be escaped again when nested in another source. Decoding one layer is different from decoding every layer of a value. |
| Escaping and sanitizing | Escaping represents special characters literally. Sanitizing removes or changes unsafe markup according to rules. Neither operation should be replaced by assuming that unknown input contains harmless display text. |
| Preview boundaries | A restricted preview can block scripts, external images, fonts, and other resources. That keeps the preview separate from active page behavior, but it also means it is not a faithful copy of every production layout. |
| Readable and compact source | Minification produces a compact delivery copy. Keep the readable source for maintenance and rebuilding. Editing only a compressed copy makes reviews harder and loses the useful context removed with comments. |
| Comments in source files | Comments can contain licenses, build notes, and explanations as well as disposable text. Before removing them, check the obligations of bundled assets and keep important notices in the appropriate source or distribution file. |