Skip to content
GigAI Tools

JavaScript Minifier: Compress & Mangle JS Online

Paste a script and get production-grade minified JavaScript instantly. Powered by terser, with name mangling, dead-code elimination and live byte-savings, all client-side, nothing uploaded.

100% browser processingFree · no sign-up
Loading tool…

What is the javascript minifier?

The JavaScript Minifier compresses scripts using terser, mangling names, eliminating dead code and stripping comments, while optionally keeping class and function names. It shows the exact bytes saved as you go. Free and browser-based, it produces production-grade output locally so your code is never uploaded.

The GigAI JavaScript Minifier is a desktop-grade JS compressor that runs entirely in your browser on top of terser, the same engine that ships inside webpack, Rollup and Next.js. Paste, drop or type JavaScript and it strips comments and whitespace, shortens local variable and function names (mangling), and applies real structural compression (dead-code elimination, constant folding, boolean and conditional simplification) to produce the smallest equivalent script. Every run reports the before and after size in bytes and the exact percentage saved, so you can see what a minify pass buys before you ship it. Unlike a naïve whitespace stripper, terser understands the syntax tree, so it never breaks your code by removing a meaningful newline or comma. When you need runtime introspection (a class name for a decorator, a function name for logging or a DI container) toggle Keep class names or Keep function names and terser preserves them while still mangling everything else. Because it is powered by ES2015+ aware parsing, it handles modern syntax: arrow functions, template literals, optional chaining, classes and async/await. And because it all happens locally, no proprietary source, API key or unreleased feature ever leaves your machine. Close the tab and it is gone.

Difficulty:
Easy
Typical time:
~15s
Processing:
100% browser processing

Last updated

How to use the javascript minifier

  1. 1

    Paste, drop or import JavaScript

    Paste into the editor, drag a .js file onto it, or click to browse. Or load the built-in sample to try it in one click.

  2. 2

    Choose your options

    Toggle mangling and compression, and turn on Keep class names or Keep function names if your framework relies on runtime name introspection.

  3. 3

    Read the savings

    The output pane updates live and the badges show input size, output size and the exact percentage saved.

  4. 4

    Copy, download or share

    Copy the minified code, download it as a .min.js file, or share a link that reopens the tool with your source pre-loaded.

What JavaScript Minifier includes

  • Real terser compression

    Runs the same terser engine bundlers use (dead-code elimination, constant folding, conditional and boolean simplification) not a naïve whitespace strip, so output is genuinely smaller and never broken.

  • Name mangling

    Rewrites local variable and function names to single characters, reclaiming the bytes long identifiers cost. Toggle it off when you want readable-ish output without renaming.

  • Keep class & function names

    Preserve class and function names for decorators, dependency injection, error stacks and logging, while still mangling everything else, the switches frameworks like Angular and NestJS need.

  • Exact byte savings

    Every run shows input size, output size and the precise percentage saved, so you can prove what a minify pass actually shaves off your script.

  • Modern syntax aware

    Handles ES2015+ and beyond: arrow functions, classes, template literals, optional chaining, nullish coalescing and async/await: without choking on modern JavaScript.

  • 100% in your browser

    Minification runs on your device with no network calls. Your unreleased source, keys and business logic are never uploaded, stored or logged.

Why use our javascript minifier

Ship smaller scripts without a build

Get bundler-quality output for a one-off script, a snippet or a CDN file without spinning up webpack, a config or a toolchain. Paste and copy.

Cut load time and bandwidth

Smaller JavaScript means faster parse, less bandwidth and better Core Web Vitals. The byte badge shows exactly how much lighter each file becomes.

Keep frameworks working

Preserve the class and function names your DI container, decorators or error reporting rely on, so aggressive minification never silently breaks reflection.

Private by design

Because it is fully client-side, you can safely minify proprietary or pre-launch code, none of it leaves your machine.

Built for the way you work

From quick one-off fixes to daily workflows, see how people put this tool to use.

  • Frontend developer

    Minify a standalone script

    Compress a small widget, analytics snippet or vanilla-JS component that has no build pipeline, then drop the .min.js straight onto your page or CDN.

  • Library author

    Produce a distributable build

    Generate a compact single-file build of a utility library for a quick release, keeping public class and function names intact for consumers.

  • Performance engineer

    Prove a minify win

    Paste a bundle chunk and read the exact bytes and percentage saved to justify enabling or tuning terser in the real build.

  • Educator / blogger

    Show minified vs. source

    Demonstrate what mangling and compression do to readable code, side by side, when teaching how JavaScript ships to production.

Supported formats

Accepts JS, MJS and TXT, and produces JS, all processed locally in your browser.

Input formats
  • JS
  • MJS
  • TXT
Output formats
  • JS

Frequently asked questions

Common problems, solved

Hit a snag? Here are quick fixes for the issues people run into most.

  • My decorators or dependency injection broke after minifying.

    Frameworks that read class or function names at runtime (Angular, NestJS, some DI containers) break when those names are mangled. Turn on Keep class names and Keep function names: terser then preserves them while still compressing everything else.

  • It reports a syntax error on valid-looking code.

    terser parses your JavaScript before minifying, so genuine syntax mistakes surface here. Check the reported message and line, and note that TypeScript, JSX or Flow-typed source must be transpiled to plain JavaScript first. This tool minifies JS, not TS or JSX.

  • The output isn't much smaller.

    Code that is already compact, or that is mostly string data, has little to gain. Ensure both Mangle and Compress are on. The biggest wins come from long identifier names and removable dead code, which short or data-heavy scripts simply don't have.

  • Nothing happens on a very large paste.

    Extremely large inputs are guarded to keep the tab responsive. Minify in sections, or run huge files through terser in your local build. The in-browser limit is generous but not unbounded.

Get the most out of it

  • Leave Mangle and Compress both on for the smallest output. They attack different kinds of waste (names vs. structure).

  • Only enable Keep class/function names when something actually reads them at runtime. Keeping them costs bytes.

  • Press Ctrl/Cmd+Enter to re-run and Ctrl/Cmd+S to download the .min.js.

  • Minifying TypeScript or JSX? Transpile it to plain JavaScript first, terser expects standard JS.

  • Check the Saved badge to decide whether a file is worth minifying at all before you wire it into a pipeline.

What's new

Recent updates and improvements to the javascript minifier.

  1. Initial release: terser-powered minification with mangle and compress toggles, keep class/function names, live byte-savings stats, drag-drop import, copy/download/share and keyboard shortcuts.

  2. Added a curated sample script and refined error reporting so terser parse failures surface a clear message and line.

  3. Improved keep-names behaviour so class and function names are preserved consistently across both the mangle and compress passes.

Your privacy is built in

Your JavaScript is parsed and minified entirely in your browser with terser running on your device. It is never uploaded to any server. Nothing is stored, logged or transmitted, so you can safely compress proprietary, unreleased or secret-bearing code. Close the tab and every trace is gone.

  • Runs in your browser
  • No uploads
  • Nothing stored

Ready to try the javascript minifier?

Free, private and instant. JavaScript Minifier runs right in your browser.