JavaScript Minifier
Strip comments and indentation from JavaScript — a conservative minifier that will not break your code.
About this tool
Aggressive JavaScript minifiers rewrite your code with a full parser; great in a build pipeline,
but risky when you just want a quick result. This tool takes the safe road: it tokenizes your
script so strings, template literals and regexes are never touched, removes comments
(except /*! … */ license banners) and strips indentation — while keeping the line
structure that automatic semicolon insertion (ASI) may depend on.
How to use it
- Paste your JavaScript, or click Sample.
- Click Minify JavaScript and copy the result.
Good to know
- Because line breaks are preserved, code that relies on ASI keeps behaving identically.
- License comments (
/*! */) survive, as legal boilerplate should. - For production bundles, prefer a build-step minifier (Terser, esbuild) for the last few percent — this tool is ideal for quick snippets, widgets and bookmarks.
- Reading minified code? The JavaScript Formatter undoes it.