JavaScript Minifier
Shrink JavaScript safely by removing comments and whitespace.
Minify JavaScript Safely
This minifier takes a conservative, safe approach: it removes comments, indentation, and blank lines, and collapses extra spaces, while preserving line breaks so automatic semicolon insertion (ASI) can never change your code's behaviour. Strings, template literals, and regular expressions are left untouched.
What it removes
- Single-line and block comments
- Indentation and blank lines
- Redundant spaces between tokens
What it never breaks
By keeping newlines, the minifier avoids the classic ASI pitfall where joining lines silently changes a return statement. Quoted strings, template literals, and regex literals are preserved exactly as written.
Conservative by design
A full optimiser like Terser renames variables and rewrites expressions, which yields smaller output but requires a complete parser. This tool prioritises correctness for quick, safe minification â ideal for snippets, inline scripts, and situations where you must be certain behaviour is unchanged.
100% Private & Processed Locally
Every conversion on this page runs entirely inside your browser using JavaScript. Your data is never uploaded to a server, logged, or stored â making this tool safe even for sensitive payloads such as API responses, configuration files, and access tokens.
Because there is no network round-trip, conversions are instant and work even when you are offline. It is free to use with no sign-up, no rate limits, and no ads injected into your output.
Frequently Asked Questions
Common questions about the JavaScript Minifier.