← All tools/Minifiers/Code/JavaScript Minifier
JavaScript Minifier
Smaller JavaScript, in your browser — paste JS in, minified JS out, with bytes saved.
Paste JavaScript here. It is minified as you type, in your browser.
Size saved
How it works
Minified = comments removed, whitespace collapsed,
spaces around {} ( ) ; , : = removed
Strings are copied untouched, so content is safe
Worked example: the sample minifies to function greet(name){return "Hello, "+name;}greet("World"); — the two comments are gone, the spaces around braces, parentheses and the equals sign are gone, and the space inside the string "Hello, " stays, because it is part of the text.
Frequently asked questions
Is my JavaScript sent anywhere?
No. Everything runs in your browser. Nothing is uploaded, stored or logged.
Will minifying break my JavaScript?
Not for ordinary JavaScript. Comments and whitespace are removed, and strings in quotes are copied untouched, so text, URLs and regular expressions inside strings survive.
Why are spaces around operators kept?
Spaces around + and - are kept on purpose: removing them can change meaning, for example a - -b is not the same as a--b. Only spaces around punctuation that can never change meaning are removed.
Does it work with arrow functions and template literals?
Arrow functions minify normally. Template literals are copied as strings, so ${} expressions inside backticks are left exactly as written.
More tools
Tell us what you think
Loving this tool, or stuck on something? Tell us — it takes a minute.
We’ll only use your name and email to reply if needed. The tool and page are filled in for you.