Text and developer tools

Code Minifier

Shrink JavaScript, CSS and HTML.

0 characters

Your text stays on your deviceHow?

How to minify code

  1. Paste your JavaScript, CSS or HTML into the box.
  2. Check the language.
  3. Copy the minified code, and see how much smaller it is.

Questions

What does it change in JavaScript?

It removes comments and spaces, shortens the names of local variables and simplifies expressions, using the terser library. Names at the top level are kept, so other scripts can still use them, and comments that start with /*! or mention a licence stay.

What does it change in CSS and HTML?

Only comments and spaces. Rules, selectors, tags and attributes stay exactly as written, and so do strings and attribute values.

Is anything in HTML kept exactly?

Yes. The content of pre, textarea, script and style tags is kept as written, because spaces matter there. Conditional comments for old versions of Internet Explorer are kept too.

Why does my JavaScript show an error?

The minifier has to read the code first. The message says where it stopped; check that quotes and brackets are closed there.

Is my code sent anywhere?

No. It is minified inside your browser, so your code never leaves your device.