Code Minifier

Shrink JavaScript, CSS or HTML before deploying. JavaScript is compressed with Terser, which can also shorten variable names and remove console calls, and syntax errors are reported with their line. CSS and HTML minification safely removes comments and extra whitespace while keeping strings, url() values and <pre>/<textarea> content intact.

How to use the Code Minifier

  1. Choose JavaScript, CSS or HTML.
  2. Paste your code or press Load example.
  3. Set options such as name mangling or comment removal.
  4. Press Minify and review the size reduction.
  5. Copy the result or download the .min file.

Features

Benefits

Frequently asked questions

Is minified JavaScript safe to use in production?

Terser is the minifier used by most modern bundlers. Still, test the minified file, especially if your code relies on function names or eval.

Why is a space kept between some HTML elements?

A space between inline elements such as <b>a</b> <i>b</i> is visible on the page, so the minifier keeps one space there to avoid changing the layout.

Why does my CSS still contain a comment?

Comments that start with /*! are licence comments and are kept on purpose. Remove them manually if your licence allows it.

Related tools