MISTOOLS

Code Minifier

Shrink HTML, CSS and JavaScript so pages load faster, or beautify minified code so it is easy to read.

How it works

  1. Choose HTML, CSS or JavaScript.
  2. Paste your code and press Minify or Beautify.
  3. Copy the result or download it as a file.

About this tool

Minifying removes comments and extra spaces that browsers do not need. Smaller files download faster, which helps your page speed. The tool shows the size before and after, so you can see exactly how much you saved.

It is careful with the parts that matter: text inside strings, regular expressions, template strings, pre tags and calc() values are kept as they are. Beautify does the opposite and spreads the code over lines with indents. Your code never leaves your device.

Questions

Is minified code safe to use?

Yes for normal code. The tool only removes comments and spaces. Always test your page after minifying, as you would with any build step.

Does it rename variables?

No. It does not shorten names, so savings are smaller than a full build tool, but the result is safer and easy to check.

Why does the JavaScript keep some line breaks?

Some code relies on line breaks instead of semicolons. Keeping them stops the code from changing its meaning.

Is my code uploaded?

No. Everything runs inside your browser.

More tools

More free Compressors