Category: Developer tools

JavaScript minifier online

System ideaMissing a tool?

Strip comments and extra whitespace from a small script

Minify a small JavaScript snippet locally by removing comments and extra whitespace while preserving strings, templates and regex content.

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

A lightweight minifier for small, simple scripts. It removes // and /* */ comments and collapses extra whitespace while preserving text inside strings, template literals and regular expressions. It is not an AST compressor like Terser and does not rename variables, remove dead code, optimize production bundles or analyze automatic semicolon insertion. The pasted JavaScript, settings and minified result stay in the browser and are not uploaded to LocalTools.

How to use it

  1. Paste or type the small JavaScript snippet.
  2. Review the minified output and size comparison.
  3. Copy the result and test it before publishing.

Privacy

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

Frequently asked questions

How do I minify a small JavaScript snippet online?
Paste or type the small JavaScript snippet. Review the minified output and size comparison.
Will this tool change text inside strings, template literals, or regular expressions?
A lightweight minifier for small, simple scripts.
Does this JavaScript minifier upload my code?
The pasted JavaScript, settings and minified result stay in the browser and are not uploaded to LocalTools.
What kinds of code are not a good fit for this lite JavaScript minifier?
No file uploads, batch minification, accounts, server processing, crawling, third-party APIs, AST compression, variable renaming, dead-code removal, production bundling, obfuscation, deobfuscation or automatic semicolon-insertion analysis.
How is this different from Terser?
Terser is a full compressor. This tool is lighter and does not do AST optimization, variable renaming or dead-code removal.