JavaScript Minifier & Beautifier
Minify JavaScript to reduce file size or beautify for readability. Removes comments and whitespace while safely preserving strings, template literals, and regular expressions. Everything runs in your browser.
What Gets Processed
Single-line Comments
// comments are completely removed
Multi-line Comments
/* block comments */ are stripped
Whitespace & Newlines
Collapsed to minimum needed for valid syntax
String Literals
Single, double, and template strings preserved intact
Template Literals
Backtick strings with ${} expressions preserved
Regular Expressions
/regex/flags patterns detected and preserved
Code Formatter Suite
This tool is part of our complete code formatter suite:
Frequently Asked Questions
What is JavaScript minification?
JavaScript minification removes unnecessary characters like comments, whitespace, and newlines without changing the code's behavior. This reduces file size for faster downloads and improved page load times. Typical savings are 30-60% depending on how much commenting and formatting the original code has.
Does this rename variables (uglification)?
No. This tool performs whitespace and comment removal only. It does not rename variables, remove dead code, or perform tree shaking. For production builds with variable mangling, use tools like Terser, esbuild, or webpack's built-in minifier. This tool is ideal for quick minification without a build pipeline.
Will minification break my code?
The minifier carefully preserves string literals (single, double, and template strings), regular expressions, and required whitespace between identifiers and keywords. It should not alter your code's behavior. However, always test minified code before deploying to production.
Is my code safe?
Yes. All minification and beautification happens entirely in your browser. No JavaScript code is sent to any server. You can safely process proprietary code, API keys embedded in config files, and any other sensitive JavaScript.