Takes out comments and whitespace without renaming anything, so the output behaves exactly as the input did.
Minified JS Code
Similar Coding Tools
What is Online JavaScript Minifier?
JavaScript Minifier is a free online tool for minifying and compressing JavaScript code. JavaScript is a scripting language used in web browsers. Its usage is extended in recent years with Node.js but main idea is to manage interactions and data flow in a webpage.
JavaScript code may be written in HTML as inline script within script tags, or it may be added to the page with a link that referencing a .js file. There are many module bundlers which automatically converts the code you wrote into minified JS files like webpack, parcel, rollup or browserify. You need to configure them, and they merge and compress your JS files without any hustle. But, if you have a tiny project which you don't need these module bundlers and you need to minify your JS code by yourself, online JavaScript Minifier will help you a lot.
When you compress Javascript code by minifying them, your file size will be decreased remarkably and it affects positively your webpages loading time and UX (User Experience). There are many configuration options in JS minification, yet this tool uses the defaults to keep things minimalistic.
Here is an image showing how Javascript minification works and how the size is decreasing after compression. It shows before vs. after for minification of a Fibonacci generator function.

After the end of minification process, a green box will be showed up that shows compression percentage if the code has not been minified already. Keep in mind that a warning will be showed if there is a validation problem with the JS code.
How to use Online JavaScript Minifier?
You can easily compress your JS code by following these.
- Fill the input field with your JavaScript code that will be converted into minified version.
- Click the button "Minify" to start minification.
- If there is no validation error in your code, you can get the result as raw code by copying to your clipboard or as a downloadable file called script.min.js.
Frequently asked questions
What does it do to my code?
Removes comments and the whitespace that only exists for readability. The logic, the names and the structure are untouched, so the output does the same thing as the input.
Why is my saving smaller than I expected?
Because whitespace is the cheapest thing to remove. The large savings in a real build come from renaming variables, dropping unreachable code and tree-shaking what is never imported — all of which need to understand your whole project, not one pasted file.
Can minifying break a script?
It can, and the usual culprit is missing semicolons. JavaScript inserts them for you at line breaks, so code that relied on that can change meaning once the line breaks go. If your source has semicolons where it should, you will not hit this.
Does minifying protect my source?
No. Anyone can read minified JavaScript with a formatter and a few seconds. If something must stay secret it belongs on a server, not in a script the browser downloads.
How do I read a minified file?
The JavaScript Formatter re-indents it. Comments and original line breaks are gone for good, but the structure comes back.
What about the HTML and CSS?
The HTML Minifier and CSS Minifier do the same for the rest of the page.