JavaScript Minifier
Strip comments and blank lines from JavaScript safely.
Input
This tool runs entirely in your browser. The data you paste or load is never uploaded.
Result
Enter your input, then run the tool.
About this tool
Conservative minifier that removes comments and redundant whitespace while leaving strings, template literals, regular expressions and automatic semicolon insertion untouched. It reports the size saved and never renames variables.
How to use it
- Paste a JavaScript file.
- Decide whether comments should be stripped.
- Minify, then test the output before deploying it.
Frequently asked questions
Will this break my code?
It is deliberately conservative, but any whitespace-sensitive code can be affected. Always run your tests against the minified file; for production builds a compiler such as esbuild is still the better choice.
Does it mangle variable names?
No. Renaming requires full scope analysis, which a text-based tool cannot do reliably.
Keep going
Related tools
CSS Minifier
Shrink stylesheets by removing comments and whitespace.
HTML Minifier
Remove comments and redundant whitespace from HTML.
JSON Minifier
Strip whitespace from JSON to shrink payloads.
JSON Formatter
Pretty-print compact or broken JSON with a readable indentation.
JSON Validator
Check JSON syntax and see exactly where it breaks.
JSON to CSV Converter
Turn an array of JSON objects into a spreadsheet-ready CSV.