EN
My tools

JavaScript Minifier

Minify JavaScript by removing comments and whitespace safely: line breaks needed by semicolon insertion are kept, strings and regexes untouched. Shows bytes saved.

Comments starting with /*! usually carry a copyright notice that the licence requires you to keep.
Minified JavaScript
Original size
364 bytes
Minified size
259 bytes
Saved
28.8%

Removed 2 comments, kept 1 licence comment.

Whitespace and comments only: variable names are not shortened and no code is rewritten, so the result behaves identically.

My tools →
Advertisement

Minifying JavaScript strips the comments, indentation and spaces that browsers do not need, so scripts download faster. This minifier works token by token: it removes whitespace and comments but never rewrites code, and it keeps a line break wherever your code depends on automatic semicolon insertion. The output therefore runs exactly like the input. It reports the size before and after in bytes.

How to use this tool

  1. Paste your JavaScript into the box; the minified code appears straight away.
  2. Leave Keep /*! licence comments on if the code includes a copyright notice you must keep.
  3. Check the sizes and the percentage saved.
  4. Copy the minified code into your .min.js file.

Formula

saved % = (original bytes − minified bytes) ÷ original bytes × 100

Sizes are UTF-8 bytes. A space stays only where two tokens would otherwise merge (return x, a + +b, /re/ in o); a line break stays where one statement ends without a semicolon and the next begins with something that could continue it, such as (, [, +, - or a name.

Example

The sample cart helper is 364 bytes. Without its two ordinary comments and its indentation it becomes 259 bytes, about 29% smaller, while the /*! licence line and the template literal stay exactly as written. A bundler that also renames variables and gzips the file would save more.

Frequently asked questions

Why is my result larger than with Terser or esbuild?

Those tools also rename local variables, drop unused code and rewrite expressions. This tool only removes whitespace and comments — safer for a quick paste, but less compact.

Why are some line breaks left in?

Without a semicolon, a line break can end a statement. Joining return and the next line, or two lines where the second starts with (, would change what the code does, so those breaks are kept.

Does it handle modern syntax?

Yes: arrow functions, classes and private #fields, optional chaining, template literals, BigInt and regex flags. TypeScript and JSX are not supported.

Is my code uploaded?

No, minification runs in your browser.

Sources

Last updated:

Cite or embed this tool
APA

kakaoCalc. (2026, November 8). JavaScript Minifier. https://kakao.mobile/tools/javascript-minifier/

MLA

“JavaScript Minifier.” kakaoCalc, 8 Nov. 2026, kakao.mobile/tools/javascript-minifier/.

Paste this code into your page. The widget runs in your visitors' browsers, shows no ads and keeps a link back to this page. Embedding terms

Advertisement