JavaScript Minifier Online
Smaller JS files, identical behavior, comments and whitespace stripped safely.
Strings, template literals and regex literals are protected. Line breaks that JavaScript needs (code without semicolons) are kept, and the result is syntax-checked.
About this tool
The JavaScript minifier removes // and /* */ comments and
collapses redundant whitespace while protecting string literals, template literals and regular
expressions. Code written without semicolons keeps the line breaks it needs, and the output is
syntax-checked in your browser before you copy it.
Minified JS loads faster and costs less bandwidth. For maximum savings, serve it gzipped too.
How to use
- 1. Paste your JavaScript.
- 2. Click Minify JS and check the Syntax check result.
- 3. Copy or download the compressed code.
Frequently asked questions
Is it safe? Will my code still work?
Yes for typical code, strings, template literals and regex are protected, and line breaks needed by automatic semicolon insertion are kept. The output is syntax-checked; test unusual code after minifying.
Does it rename variables?
No, this is a safe whitespace/comment minifier, not an optimizing compiler. For variable mangling use Terser or esbuild.
Is it free?
Yes, unlimited, no signup.
Is my code uploaded?
No, everything runs in your browser.
Is your website secure? Run the free 7-section scan: vulnerabilities, malware, headers, SEO and speed.
Scan my websiteRelated tools
More from Formatters & Minifiers and Developer.