JavaScript Minifier

No upload · runs in your browser
Licence banners
JavaScript in
0 characters
Minified

Runs entirely in your browser, nothing is uploaded.

How it works

JavaScript Minifier : Strip Comments and Whitespace

Strip comments and needless whitespace from JavaScript. Strings, template literals and regexes are treated as untouchable, so the code that comes out still does what it did going in.

What this does
  • Removes line and block comments, with a switch for keeping /*! and @license banners
  • Never edits inside a string, a template literal with nested ${} expressions, a regex or a comment
  • A newline survives only where automatic semicolon insertion needs it, such as after return
  • Byte count before and after, with the percentage saved
FAQ

No. It removes the characters a parser ignores, comments, and whitespace between tokens, and changes nothing else. Renaming identifiers safely needs full scope analysis, which is what esbuild and Terser exist for. Use this to strip a file before pasting it somewhere, or to see how much of a file was comments; use a real bundler in a build.

Keep going