How to use the javascript minifier
- Paste your JavaScript into the left box, or click Open File.
- The minified code appears on the right, with the size saving shown underneath.
- Click Copy or Download.
What minifying does
Code is written with spacing and comments so that people can read it. Browsers do not need any of that. Minifying removes it, which makes the file smaller, so pages load faster and use less data.
| Before | After |
|---|---|
| function add(n,d){return n+d} |
What is removed
- Comments
- Line breaks, indentation and spaces
- Code that can never run
- Long names inside functions, replaced with short ones
Is it safe?
Minifying is done by Terser, the engine used by most modern build tools. It understands the code instead of just deleting spaces, so the script behaves the same. Names you use from other files are not renamed. Keep your original file for editing and put the minified copy on your website.
Does minifying really help?
Typical savings are 15% to 30% for CSS and HTML and 30% to 60% for JavaScript. Smaller files mean quicker page loads, which helps visitors on phones and is one of the things search engines measure.
See also the CSS Minifier and the HTML Minifier.
Your data stays on your device
The conversion runs entirely in your web browser. Nothing you paste or open is sent to a server, so it is safe to use with customer lists, exports and other private data. There is no sign-up and no size limit beyond what your device can handle.
Frequently asked questions
How do I minify JavaScript?
Paste the code into the left box. The minified version appears on the right, ready to copy or download.
Will minified JavaScript still work?
Yes. Only characters the browser does not need are removed, so it behaves the same.
Can I turn minified code back?
You can add line breaks back with a formatter, but comments and original names are gone for good. Always keep your original file.
Is my code uploaded?
No. It is processed in your browser and never sent to a server.