JavaScript Minifier – Minify & Beautify JS Online
Calcon's JavaScript Minifier uses Terser — the same engine used by Webpack, Vite, and Rollup — to compress your JS for production. Paste your code, click Minify, and get the optimised output with full compression stats. Click Format to beautify compressed code back into readable form. Everything runs in your browser; no code is uploaded.
Minify vs Beautify
| Action | What it does | When to use |
|---|---|---|
| Minify | Removes whitespace, comments; mangles names | Production deployment |
| Format / Beautify | Adds indentation and newlines for readability | Debugging, code review |
Frequently Asked Questions
What does a JavaScript minifier do?
A JavaScript minifier removes unnecessary characters from JS code — whitespace, comments, and newlines — and shortens variable names (mangling) to produce smaller, functionally identical code. This reduces file size and speeds up page load.
Is minified JavaScript still valid?
Yes. Minified JavaScript is syntactically identical to the original — only whitespace, comments, and optionally variable names are changed. Browsers execute minified JS exactly the same way as the original.
What is the difference between minifying and uglifying?
Minifying removes whitespace and comments. Uglifying additionally mangles variable names (e.g., "calculateTotal" becomes "a") for maximum compression. Terser does both when you use the Minify button.
What is JavaScript beautifying?
Beautifying (also called formatting or pretty-printing) takes compressed or poorly formatted JS and adds consistent indentation, newlines, and spacing to make it readable. It is the reverse of minification.
Does my code leave the browser?
No. This tool uses the Terser library entirely in your browser. Your JavaScript code is never sent to any server. All minification and beautification runs locally.
What library does this tool use?
This tool uses Terser, the industry-standard JavaScript compressor used by Webpack, Vite, and most modern build tools. It supports ES2020+ syntax.
How much can JavaScript minification reduce file size?
Typical savings are 30–60% depending on how much whitespace, comments, and long variable names the original code has. Combining minification with Gzip compression (which servers do automatically) can achieve 70–90% size reduction.
Can I minify TypeScript with this tool?
No. Terser only accepts JavaScript. You need to compile TypeScript to JavaScript first (using tsc or your build tool), then minify the resulting JS. TypeScript source with type annotations will cause a syntax error.
Related Developer Tools
Base64 Encoder / Decoder
Encode and decode Base64 instantly.
Border Radius Generator
Generate CSS border-radius visually with live preview.
Box Shadow Generator
Generate CSS box shadows visually with live preview.
Color Palette Generator
Create harmonious color palettes from any color.
Color Picker
Pick colors and get HEX, RGB, HSL, CMYK instantly.
CSS Formatter / Beautifier
Format and beautify CSS code instantly.
CSS Gradient Generator
Generate linear, radial, and conic CSS gradients visually.
CSS Minifier
Minify CSS code instantly in browser.
HEX to RGBA Converter
Convert HEX colors to RGB/RGBA instantly.
HTML Minifier
Minify HTML to reduce page size instantly.
