← All tools
🗜️

HTML, CSS & JavaScript Minifier

Shrink HTML, CSS and JavaScript for faster pages, or beautify minified code so you can read it. Powered by Terser, CSSO and js-beautify — all in your browser.

Free · No sign-up

How to use HTML, CSS & JS Minifier

  1. 1. Paste your HTML, CSS or JavaScript — or load an example. The language is detected automatically.
  2. 2. Pick options: shorten variable names, remove console calls, keep license comments, minify inline styles and scripts.
  3. 3. Click Minify to shrink the code, or Beautify to re-indent it with 2 spaces, 4 spaces or tabs.
  4. 4. Check the size and gzip savings, then copy or download the result. Errors show the line and column.

Frequently asked questions

What does minifying code do?

Minifying removes comments, whitespace and line breaks and shortens names so files download faster. The code works exactly the same. On real sites JavaScript often shrinks by 30–60% and CSS by 15–30% before gzip.

Is minified JavaScript safe to use?

Yes. Terser, the minifier used by most modern build tools, only makes changes that keep behavior the same. Global names, exports and object property names are kept. Always test the result, especially code that relies on function names.

What is the difference between minify and beautify?

Minify makes code as small as possible for production. Beautify does the opposite: it re-indents minified or messy code so people can read and edit it. You can switch back and forth with “Use result as input”.

Does the HTML minifier break my layout?

It is conservative. Spaces between inline elements like links or bold text are kept as a single space, <pre> and <textarea> are untouched, and conditional comments stay. Only whitespace next to block elements and ordinary comments are removed.

Are license comments kept?

By default, comments starting with /*! or containing @license or @preserve are kept, as most open-source licenses require. Untick the option to remove them.

Is my code uploaded anywhere?

No. The libraries load from a public CDN and run in your browser, so your code never reaches a server. Share links only contain your settings.

🛠️ Browse all text & developer guides and tools →