Online JavaScript minify and format: strip comments, optionally drop console/debugger, compact punctuation; protects strings and regex; shows char/UTF-8 size delta. Runs locally.
TL;DR: Free online JavaScript minifier powered by Terser with ES6+ support. Shortens variable names and tree-shakes unused code safely, runs locally in your browser.
For local tools, open DevTools → Network and search your input — it should not appear in requests.
Usage Guide
JS size drives load time: stripping comments and extra whitespace often cuts hand-written source by roughly a third. This tool minifies locally in the browser (nothing uploaded) and shows character vs UTF-8 byte savings — identifier names stay intact so runtime name lookups are not broken.
1. Minify a script
- Paste JavaScript (ES5 and common ES6+ both work).
- Toggle options: remove comments, drop console.*, drop debugger, compact punctuation spacing.
- Minify and read the char/byte savings; use Format (Prettier) when you need readability back.
- Smoke-test before shipping — especially after dropping console, confirm no retry logic depends on logs.
2. What this tool does — and does not
- Does: strip comments (keeps /*! and @license), collapse whitespace, optional console/debugger removal, protect strings and regex literals.
- Does not: mangle names, dead-code eliminate, or constant-fold — that belongs to Terser/esbuild in a build pipeline.
- Unbalanced brackets surface a line/column warning while minify still runs — treat it as a clue, not a fix.
3. Two checks before minifying
- Keep the source copy: minification is irreversible; the output is a build artifact.
- Legacy ASI-heavy code can change meaning when lines collapse — run unit tests after minifying.
4. The right way in production
Bundlers minify during build. Use this tool for static pages without a pipeline, one-off script shrinks, or measuring how much drop-console saves. Hand-minifying every release is the signal to automate.
5. Reading the size numbers
The panel reports both characters and UTF-8 bytes. With CJK comments or non-ASCII strings, byte savings often exceed character savings — CDNs bill bytes. Brotli/Gzip stack on top of source minify; they do not replace it.
FAQ
Lexical-level compression: it strips comments and redundant whitespace, tightens punctuation spacing, and can optionally drop console calls and debugger statements. String, template, and regex literals are stashed before processing, so content like "https://..." never gets eaten by comment stripping.
No. There is no identifier renaming and no full tree-shaking or compatibility transpiling here — those belong to a bundler and its CI pipeline. For project-scale builds, treat your bundler config as the source of truth; this page is for ad-hoc snippets.
It only touches comments, whitespace, and optional debug statements — it never rewrites your syntax. If the source itself has a syntax error (unmatched brackets, for example), minification fails and points to the location, so fix the syntax first.
Blocks starting with /*! and blocks containing an @license marker are preserved automatically; ordinary comments go away by default. Generating sourcemaps is out of scope — use your build tooling for those.
Yes, inputs over 2MB are rejected with a message telling you to split the file. Confirm your option combo and output on a small sample first, then work through long files in segments.
No. Everything runs inside the browser with no third-party minifying service involved, which makes it comfortable for unreleased code.
Related Tools
Related Articles
Online CSS Minifier: Reduce CSS File Size for Better Performance
Learn how to minify CSS safely: whitespace, comments, hex shortening, zero-unit elision, calc protection, and UTF-8 byte savings — with an online tool you can use locally.
Online JavaScript Minifier: Reduce JS File Size for Faster Page Loads
Learn how to minify JavaScript to cut file size. Cover minification basics, this site's options (comments, console, size compare), and how they differ from Terser/esbuild in a build pipeline.
Online HTML Minifier: Reduce HTML File Size for Faster Loading
Learn how to compress HTML to cut file size. Cover minification strategies, optional comment stripping and IE conditional comments, script/style/textarea boundaries, and char vs UTF-8 byte savings in an online tool.