optimize

HTML Minify

Minify HTML with html-minifier-terser — collapse whitespace, drop comments and redundant attributes, optionally minify inline CSS / JS. Inverse direction of the existing html-formatter.

Loading…

About HTML Minify

HTML Minify shrinks your markup by collapsing whitespace, deleting comments, and dropping redundant attributes, with an option to compress inline CSS and JavaScript too. Reach for it right before deploying a page or email template, when you want the smallest possible payload without rewriting anything by hand. It runs on html-minifier-terser entirely in your browser, so the markup you paste never leaves your machine.

Category
optimize
Input
Accepts: text/html or text/plain.
Output
Outputs: text/html (multiple).
Cost
Free, runs in your browser
Memory
low
Privacy: HTML Minify runs entirely on your device. Files you provide never leave your browser — no uploads, no server, no tracking. The page works offline once loaded.

Common uses

  • Shave kilobytes off a landing page before pushing it to production to improve first-paint time
  • Minify an HTML email template so it stays under Gmail's clipping threshold
  • Strip developer comments and debug attributes out of markup before handing it to a client
  • Compress inline <style> and <script> blocks in a single-file widget you're distributing
  • Clean up exported HTML from a CMS or page builder that ships bloated, comment-heavy output
  • Reverse a pretty-printed file back into compact form after you've finished editing it

Frequently asked questions

What input does it accept?

Any HTML pasted as text/html or text/plain. It returns minified text/html.

Does my HTML get uploaded anywhere?

No. Minification runs locally in your browser via html-minifier-terser, so nothing is sent to a server.

Can it also minify the CSS and JavaScript inside my page?

Yes. There are options to minify inline <style> and <script> contents in addition to the HTML structure itself.

Is there a size limit?

There's no hard cap, but very large documents are processed in your browser's memory, so extremely big files depend on your device's resources.

Will minifying break my page?

It only removes safe-to-drop whitespace, comments, and redundant attributes. The rendered output stays identical; just re-test if you rely on significant whitespace in <pre> or similar.

How do I undo it later?

Run the output through HTML Formatter to pretty-print it back into readable, indented markup.

Keywords

  • html
  • minify
  • compress
  • optimize
  • whitespace

Try next