JavaScript Minifier
Why use a private JavaScript minifier?
The code you minify is usually code you're about to ship: proprietary logic, internal API endpoints, analytics or tag snippets with account IDs. Online minifiers that send your code to a server for processing hand a copy to someone else.
formatvault minifies JavaScript with terser, the same minifier Vite, webpack, and Rollup use for production builds, running entirely in your browser. Your code never leaves your machine, and you see exactly how much smaller it gets, both minified and gzipped.
How it works
terser parses your code into a syntax tree, then compresses it (removing dead code, inlining constants and small functions, simplifying expressions) and mangles local variable names down to single letters. Finally it prints the result with no unnecessary whitespace. The code is never executed.
Minification runs in a Web Worker so large files don't freeze the page. The size bar compares the original, minified, and gzipped sizes, and the diff view shows what changed. Need to go the other way? The JavaScript Formatter turns minified code back into readable form.
Common use cases
- Shrinking inline scripts, bookmarklets, and embed snippets without a build pipeline
- Minifying tag manager and analytics snippets before pasting them into a CMS
- Checking how much a library or file shrinks when minified and gzipped
- Preparing small scripts for HTML email, browser extensions, or userscripts
- Comparing compress and mangle settings to see what each one saves
- Stripping comments from code while keeping required license headers
Frequently asked questions
- Is my code uploaded anywhere?
- No. terser runs in a Web Worker inside your browser. Your source code is never sent to a server, logged, or stored — closing the tab discards it.
- Is the minified code safe to ship?
- terser is the minifier used by Vite, webpack, and Rollup for production builds, and its transformations preserve behavior for standard JavaScript. Still, test the output before deploying, especially code that relies on function.name or Function.prototype.toString, which mangling can change.
- What is the difference between Module and Script?
- Module treats top-level names as private to the file, so unused top-level code is removed and the rest is renamed. Script keeps top-level names unchanged, because other scripts on the same page may use them as globals. Choose Script for classic <script> tags, bookmarklets, and snippets pasted into other pages.
- Which comments are kept?
- By default, only license comments: those starting with /*! or containing @license or @preserve. You can also remove every comment or keep them all.
- Does it support TypeScript or JSX?
- No. terser only understands standard JavaScript. Compile TypeScript or JSX to JavaScript first; the JavaScript Formatter on this site can format TypeScript and JSX.
- What does the gzipped size mean?
- Web servers usually compress JavaScript with gzip or Brotli before sending it. The gzipped figure is roughly what visitors actually download, which is often a fraction of the minified size.