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.

Free to useNo account neededProcessed on your device
Your workspaceProcessed on your device

Add this tool to your website

Paste this code into your page to add the tool and a visible ToolMellow credit link.

HTML embed code
Preview embed

HTML Compressor: how to use it

  1. Choose a fragment or a complete HTML document and supply the source.
  2. Compress with the default settings, then compare the input and output byte counts.
  3. 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.

Guides