ToolsMaxxing

HTML, CSS and JS minifier

Shrink HTML, CSS and JavaScript by removing whitespace, comments and extra bytes.

Your files stay on your device

How it works

  1. 1Choose JavaScript, CSS or HTML.
  2. 2Paste your code, or choose Try an example.
  3. 3Set the options for that language.
  4. 4Copy the minified code or download it, and check the size line under the boxes.

What the options do

JavaScript
Uses Terser to remove comments and whitespace, simplify expressions and drop unreachable code.
Shorten variable names
Renames local variables to single letters. Switch off if your code reads names at run time, for example through eval.
CSS
Uses csso to merge rules, shorten colours and values, and remove comments.
HTML
Collapses whitespace and removes comments and redundant attributes.
Minify inline CSS and JS
Also shrinks code inside style and script tags in HTML.

Privacy

Everything runs in your browser. What you paste is never sent to a server. Unreleased code stays on your device.

Questions people ask

Is minified code safe to use?

Minifiers are designed to keep behaviour the same, but test the result. Code that depends on function names, relies on eval, or has syntax errors can break. Keep your original file.

Why does it report a syntax error?

JavaScript is parsed before it is shrunk, so errors such as a missing bracket stop the tool and show the line. CSS and HTML are more forgiving and are often minified as written.

How much smaller will my file get?

It depends on how much whitespace and how many comments you have. Hand-written files often shrink by 20 to 60 percent. Turning on gzip or Brotli on your server saves more on top.

Does it support modern JavaScript?

Yes. Current syntax such as arrow functions, classes, async functions and optional chaining is supported. It does not convert code to older syntax.

Can I get a source map?

No. This tool outputs only the minified code. Use your build tool when you need source maps for debugging.

Related tools