Skip to content
Free tool · runs in your browser

HTML minifier

Strip comments and whitespace, compress inline CSS, and see exactly how many bytes you saved. Safe mode never touches the text of your JavaScript.

What minifying HTML actually saves

An HTML minifier removes the bytes a browser does not need: comments, indentation, line breaks and the spaces inside CSS rules. On a hand-written page that typically saves 10–25% before compression. Over HTTPS most hosts — including every page published on HTMLtoLink — already compress responses with gzip or Brotli, which narrows the gap, so the bigger wins are usually elsewhere: oversized images, unused libraries, or a 2 MB font. Minify when every kilobyte matters (embedding HTML in an email, a QR code payload, or a data URL) or when you want to hide comments meant for you, not your audience.

Why JavaScript is left alone

Safely minifying JavaScript needs a real parser: a // inside a string or a regular expression looks like a comment to a simple search-and-replace, and deleting it breaks the script. This tool only trims indentation and blank lines inside <script> blocks. If you need serious JS compression, run the script through a tool like Terser first, then paste the result here.

The "remove all space between tags" option

By default one space is kept wherever there was whitespace between two tags, because between inline elements that space is visible — <b>Hello</b> <i>world</i> needs it. Turn on the tight option only when your layout is made of block elements or flex/grid containers where the gaps do not render.

Related guides

Frequently asked questions

Is minified HTML bad for SEO?

No. Search engines read minified and formatted HTML identically. Smaller pages can load slightly faster, which helps a little. Published HTMLtoLink pages are noindex anyway.

Can I undo minification?

Comments are gone for good, but structure can be restored with the HTML formatter. Keep your original file as the source you edit.

Why is my page broken after minifying?

Almost always the tight option removing a visible space between inline elements, or a white-space: pre element outside pre. Minify again without the tight option.

More free tools

Your HTML deserves a real link

Paste code, drop a file, a ZIP or a whole folder — get a live URL with your own address, an optional password and a QR code. Free to start with Google sign-in; paid plans keep links online for good.

Turn HTML into a link