JavaScript Minifier
Minify JavaScript by removing whitespace, comments, and unnecessary characters. Reduce JS file size for faster page loads.
Quick answer
JavaScript Minifier is a free online tool that helps you minify javascript locally with terser. Minify JavaScript by removing whitespace, comments, and unnecessary characters. Reduce JS file size for faster page loads.
What is a JavaScript Minifier?
Remove unnecessary JavaScript formatting with a syntax-aware parser. Terser is loaded locally with the page assets only when you first select Minify JS.
How do you use JavaScript Minifier?
- Paste valid JavaScript, not JSX or TypeScript.
- Select Minify JS. If parsing fails, correct the syntax shown in the error.
- Copy the result and test it with the application that will run it.
What does JavaScript Minifier help with?
Preserving a URL inside a string
const url = "https://example.com/a"; keeps its complete URL. The // inside a quoted string is part of the value, whereas a // comment outside a string can be removed.
How does JavaScript Minifier work?
Formatting without executing code
Terser parses strings, regular expressions, template literals and statement boundaries. Compression and variable renaming are disabled, and important license comments are preserved. This tool does not execute your code, bundle imports, produce source maps or prove that the program is correct.
JavaScript Minifier FAQ
What is removed during minification?
Unnecessary formatting and ordinary comments are removed. Important license comments are retained. Strings, regular expressions and template literals are parsed as JavaScript.
Does it rename variables?
No. This tool uses Terser with variable mangling and compression disabled.
Is minified JS safe for production?
Test the result with your application before deploying it. This tool accepts JavaScript, not TypeScript or JSX, and does not bundle dependencies or generate source maps.