๐ฆ JavaScript Minifier
136 bytes
Minified code
function greet(name){
const message=`Hello, ${name}!`;
return message;
}
console.log(greet('World'));102 bytes25% smaller
Strips comments and extra whitespace/indentation from JavaScript source code to reduce its file size. The contents of strings, template literals, and regular expression literals are left untouched โ only the surrounding code structure is compacted.
How to use
- Paste the JavaScript code you want to minify into the input box.
- The minified result appears automatically below.
- Click "Copy" to copy the minified code to your clipboard.
FAQ
Does this rename variables (mangling)?
No, this is a basic minifier that only strips comments and compacts whitespace. It doesn't perform advanced optimizations like variable renaming.
Are regular expression literals handled correctly?
Yes. Slashes inside strings or regex literals, like / or //, are distinguished from real comments so they're never stripped.
Will the minified code behave exactly like the original?
For most common code it will, but this tool doesn't guarantee correctness for every possible JavaScript syntax edge case. For production use, verify the minified output before shipping it.