JS Minifier (basic)
Minify JavaScript by stripping line/block comments and extra whitespace. Works for simple code without full AST parsing.
—
Atenção: minificação simples sem AST. Pode alterar comportamento se houver ASI ou template literals complexos — teste sempre.
An honest cleanup, not a Terser replacement
Sometimes you just want the comments and indentation gone from a chunk of JavaScript: to inline it in a page, build a bookmarklet, or squeeze it into a character-limited field. Installing Node and configuring Terser for that is overkill. Here you paste the code and read the result instantly, with byte counts before and after so you can see exactly what the cleanup bought you.
The order of operations matters: the tool first shields strings, whether single-quoted, double-quoted or template literals, so it never deletes a // that lives inside text; only then does it strip line and block comments and squeeze out spaces and indentation. One deliberate detail: line breaks between statements are kept. That is what prevents JavaScript's automatic semicolon insertion, ASI, from changing your code's behavior when lines get joined.
Treat it as a cleanup, not real compression: with no syntax analysis, nothing gets renamed or rewritten, so the savings come from comments and whitespace alone. The page itself warns that edge cases can alter behavior; run the output or diff it before publishing anything. For production minification, Terser or esbuild do the full job with far bigger reductions. The code you paste never leaves your browser.
Frequently asked questions
Does this replace Terser or esbuild?
Why does the output still have line breaks?
Can removing a comment take a URL from my code with it?
Related Tools
HTML Minifier
Minify HTML by removing comments and collapsing whitespace between tags while preserving <pre>, <code> and <textarea> content.
CSS Minifier
Minify CSS by removing comments, extra whitespace and line breaks. Reduces file size without changing behavior.
JSON Formatter
Format, validate and minify JSON online. Paste raw JSON and get a readable, indented version.