Code · Made a little simpler
HTML Compressor
Compress HTML documents or fragments on your device. Compact attributes, optionally remove comments or collapse text whitespace and compare byte sizes.
Control whitespace when compressing HTML
Free to useNo account neededProcessed on your device
Your workspaceProcessed on your device
HTML Compressor: how to use it
- Choose a fragment or a complete HTML document and supply the source.
- Compress with the default settings, then compare the input and output byte counts.
- Enable text whitespace or comment removal if appropriate, review the result and download compressed.html.
Limits and notes
Input can contain up to 1,000,000 UTF-16 code units. Local files must be valid UTF-8 and at most 4 MiB. Embedded script and style contents are preserved. Pasted HTML remains text in the workspace. Collapsing ordinary whitespace can affect pages styled with CSS white-space rules.
How your privacy works →HTML Compressor: common questions
Will compression remove spaces inside preformatted code?
The whitespace option protects pre, textarea, script and style contents. Ordinary text outside protected regions can change when the option is enabled.
Can I keep comments?
The default keeps all comments. Remove ordinary comments retains conditional comments and recognized preservation markers.