A smaller source for the provided commented example. Its total([4, 8, 15]) calculation should still produce 27. Exact savings depend on the input, not a promised fixed percentage.
CHECK & OPTIMIZE · FREE JAVASCRIPT TOOL
JavaScript Minifier with Size Comparison
Remove comments and redundant spacing with token-aware minification, preserve significant line boundaries and compare original versus output UTF-8 bytes.
Ready in your browser
Your processed result will appear here.
A WORKED TASK
Reduce presentation whitespace while preserving JavaScript tokens
Run the total example and compare the source and output sizes. The minifier removes comments and redundant spacing while retaining line boundaries that can matter to automatic semicolon insertion. Download the result only after testing it with the same inputs as the readable source.
This is conservative token-based minification, not bundling, variable mangling, transpilation or compressed HTTP delivery. The displayed comparison is UTF-8 source bytes, not a gzip measurement.
What to check
- Keep the readable source for maintenance; minified code is harder to inspect.
- Preserve required licence notices in your distribution separately if your licences require them.
- Test code using regular-expression literals, template strings and return followed by a newline. Those are easy places for simplistic whitespace removal to change behavior.
TESTED & REVIEWED
Know what this tool does—and where to double-check
- Reviewed by
- HTML Online Viewer project
- Last reviewed
- Processing
- Ordinary processing happens in this browser tab; the tool does not intentionally upload your source.
- Important limitation
- JavaScript checks and transformations cannot prove that application logic is correct. Test the result in its real project before publishing.
PRACTICAL EXAMPLE
Start with a small JS Minifier example
The built-in sample makes the accepted input visible before you use your own project data.Example input
// Calculate the total
function total(values) {
return values.reduce((sum, value) => sum + value, 0);
}
console.log(total([4, 8, 15]));Run the sample first, then change one value at a time so each result remains easy to explain.
What this example demonstrates
Remove comments and redundant spacing with token-aware minification, preserve significant line boundaries and compare original versus output UTF-8 bytes.
Keep the original file, review the generated result and test production code in its real application before publishing.
COMMON QUESTIONS
JS Minifier FAQ
Is JS Minifier free?
Yes. It is free to use and requires no account.
Does JS Minifier upload my source?
No. Ordinary processing happens locally in the current browser. The JavaScript runner uses a short-lived isolated browser worker.
Can I import and export a file with JS Minifier?
Yes. Import a relevant JavaScript, JSON or text file, then save the input or processed result.