JavaScript Minifier
Minify JavaScript with Terser: remove whitespace and comments, shorten variable names and drop dead code.
Runs in your browserJavaScript → JavaScript
Loading tool…
Example
function add(first, second) {
// sum two numbers
const total = first + second;
return total;
}
console.log(add(1, 2));function add(d,n){return d+n}console.log(add(1,2));How to use the JavaScript Minifier
- Paste or type your JavaScript into the input area, or open a file from your device.
- Adjust the options above the editor if the tool offers any.
- Review the JavaScript result, then copy it or download it as a file.
Privacy and limitations
- Your data is processed on your device and is not uploaded to any server.
Frequently asked questions
Will minifying change how my code behaves?
No. Terser only applies transformations that keep behaviour identical. Turn off "Mangle" if other scripts access your local names via eval or Function.toString.
Related converters
CSS MinifierMinify CSS by stripping comments and whitespace and dropping redundant semicolons, without touching strings or URLs.HTML MinifierMinify HTML: remove comments and collapse whitespace while preserving <pre>, <textarea> and <script> contents.JavaScript Syntax ValidatorCheck JavaScript for syntax errors using the latest ECMAScript grammar, with line, column and a code frame.JavaScript BeautifierFormat and beautify JavaScript (including JSX and modern syntax) with Prettier: indentation, quotes and semicolons.