Category: Developer tools

JavaScript Minifier (Lite)

System ideaMissing a tool?

Strip comments and extra whitespace from a small script

Paste a small JavaScript snippet to strip // and /* */ comments and collapse whitespace, without touching the contents of strings or regular expressions. Runs entirely in your browser.

This is a whitespace and comment stripper, not a full parser or AST-based minifier. It does not perform semicolon-insertion analysis, so removing newlines can rarely change behavior in code that relies on automatic semicolon insertion. Use it for small, simple snippets, not production bundles.

Original size186Minified size104Reduction44%
Minified output
function greet(name) {
var message ="Hello, "+ name +"!";
return message;
}
console.log(greet("world"));

Everything on this page is processed in your browser. Nothing is uploaded.

What this tool does

This is a lightweight minifier, not a full parser or AST-based tool like Terser: it tracks strings, template literals and regular expressions closely enough to leave their contents untouched, then removes comments and collapses whitespace around them. It does not perform semicolon-insertion analysis, so it is meant for small, simple snippets rather than production bundles or code that leans on unusual automatic-semicolon-insertion behavior.

How to use it

  1. Paste or type a JavaScript snippet into the input box.
  2. Review the minified output and the size comparison below it.
  3. Copy the result, and always test minified output before shipping it.

Privacy

This tool runs entirely in your browser. Your input is never uploaded, stored or shared — closing the tab removes it.

Frequently asked questions

Is my code uploaded anywhere?
No. Minification runs in JavaScript in your browser tab; nothing is sent to a server.
Will this break my code?
It is designed to be conservative: it leaves whitespace inside strings, template literals and regular expressions untouched. But it has no understanding of your program's logic, so always test minified output, especially for code that depends on line breaks for automatic semicolon insertion.
Should I use this instead of a real bundler minifier?
No. For production code use a proper AST-based minifier such as Terser or esbuild. This tool is meant for quick, small snippets where installing a build tool is not worth it.