You are offline. Tools you have opened before keep working.
JavaScript minifier
Make JavaScript smaller by removing comments, indentation and unnecessary spaces. Variable names stay as they are, so the code keeps working exactly the same.
Free and private. Everything runs in your browser, nothing is uploaded.
JS
JS
Report a problem
How it works
Paste your JSPaste the code, type it or open a file. Try Sample to see an example.
Check the resultThe result appears on the right as you type. Errors are shown with the line and column.
Copy or downloadCopy the JS with one click or download it as a file.
Whitespace minification you can trust
This minifier removes what the engine ignores and nothing else. Line breaks that end a statement in code without semicolons are kept, so automatic semicolon insertion works as before.
For the smallest possible bundles a build tool that also renames variables goes further, but for quick fixes, snippets and inline scripts this is the safe choice.
The size before and after is shown next to the result, together with the percentage saved.
About JS
JavaScript is the language of web pages and many tools. The formatter understands strings, template literals, regular expressions and comments, so it never breaks code by touching their contents.
Frequently asked questions
Will my code still work?
Yes. Only comments and whitespace are removed, and line breaks that change meaning are kept. Strings, regular expressions and template literals are untouched.
Is my code uploaded anywhere?
No. Formatting and minifying run in your browser. Your code is not sent to our servers.
Does minifying rename my variables?
No. Minifying removes comments, line breaks and spaces only. Names stay readable and the code behaves exactly the same, which makes it safe for any file.
Why are some line breaks kept in minified JavaScript?
JavaScript treats some line breaks as the end of a statement. Where removing one could change what the code does, it is kept.
Can I format JSON here?
JSON has its own tool with a tree view and validation. Use the JSON Tools page linked below.
Does it work offline?
Yes. After you open the page once, it keeps working without an internet connection.