Input JavaScript
Minified
100% Private
Minification runs entirely in your browser. Nothing uploaded.
JavaScript Minifier compresses JS code online for free using Terser. Minify JavaScript by removing whitespace, shortening names, and dropping comments to shrink files.
Written & reviewed by Helperzy Editorial Team · Updated July 2026
Input JavaScript
Minified
100% Private
Minification runs entirely in your browser. Nothing uploaded.
Paste the code you want to compress into the input area. Modern syntax is fine, since Terser parses arrow functions, classes, async-await, and optional chaining without transpiling.
Decide whether to mangle local variable names and whether to drop console calls left over from debugging, then click Minify JS to run the parse, compress, and mangle passes.
Check the reported size saving and test the result before deploying, then copy the compressed code while keeping your readable source in version control.
Unminified JavaScript makes your users download every convenience you wrote for yourself: the indentation, the explanatory comments, the variable named currentUserSubscriptionStatus. None of it reaches the runtime with any meaning attached. This minifier runs Terser, the compressor that sits inside Webpack, Rollup, and most modern build chains, directly in your browser and returns functionally identical code at a fraction of the size. It suits developers pasting a snippet into a CMS field, anyone self-hosting a small library, and people who want to see the real saving on a file before wiring minification into a build. Terser works in three distinct stages, and knowing which one is doing the work helps you read the result. First it parses your source into an abstract syntax tree, which is why invalid input produces a parse error instead of mangled output. Then the compress pass rewrites the tree: constant expressions are folded, unreachable code after a return is dropped, if-else chains collapse into ternaries, and repeated literals may be hoisted. Finally the mangle pass walks each scope and renames local bindings to single letters, starting with a, b, c. Mangling is scope-aware, so it only renames identifiers it can prove are local — your exported functions, global names, and object property keys stay untouched, which is why the compressed file still works when called from elsewhere. The drop-console option removes console calls entirely during compression rather than leaving empty statements behind. Here is the effect on real code. Take this function: function calculateTotalPrice with parameters itemPrice and taxRate, a const declaration for taxAmount equal to itemPrice times taxRate, a console.log of the tax amount, and a return of itemPrice plus taxAmount, with a two-line comment above it. That is 236 bytes formatted. Minify with mangle and drop-console enabled and you get roughly function calculateTotalPrice open-paren a comma b close-paren then a const of a times b and a return — around 74 bytes, a saving near 69 percent. Notice what survived: the function name calculateTotalPrice, because it is a top-level declaration something else might call. The parameters became a and b, the comment and the console line vanished, and the intermediate const may be inlined into the return expression entirely if the compress pass judges it single-use. Where this matters in practice. A marketer pasting a tracking snippet into a Shopify theme field has a character budget and no build step available. A developer self-hosting a 40 KB utility library instead of loading it from a CDN wants it down near 15 KB before Gzip. Someone chasing a Lighthouse warning about unused JavaScript uses the reported saving to decide whether minification alone is enough or the real problem is a dependency. A WordPress plugin author ships a single compressed file because users will not run npm install. A developer writing an inline script for the document head keeps it tiny since it blocks parsing. A few honest cautions. Minified code is undebuggable in a browser console — that is what source maps are for, and this tool does not produce them, so keep your readable source in version control and only minify the deployed copy. Do not confuse minification with obfuscation or with security: mangled names slow a curious reader down for about a minute, and anything shipped to a browser is readable, so never hide an API secret in there. The pitfall that actually bites people is code depending on a function's name or a variable name at runtime, for example reading Function.prototype.name or looking up a property by a string that a bundler cannot see; mangling breaks that silently. Test the minified output before you ship it. Compression runs entirely in your browser, so proprietary and client code is never uploaded.
Input
// Work out the price including tax function calculateTotalPrice(itemPrice, taxRate) { const taxAmount = itemPrice * taxRate; console.log(taxAmount); return itemPrice + taxAmount; } (166 bytes)
Result
function calculateTotalPrice(a,b){const c=a*b;return a+c} (57 bytes)
The comment and the console call are removed, whitespace collapses, and the two parameters plus the local const are mangled to a, b, and c. The function name survives because something outside this file may call it. 166 bytes down to 57 is a 65.7 percent saving.
Input
const total = 60 * 60 * 24; if (total > 0) { doWork(); } else { return; }
Result
const total=86400;total>0&&doWork();
The compress pass folds the constant arithmetic to 86400 at build time, then rewrites the if-else into a short-circuit expression because the else branch only returns. Both changes are behaviour-preserving.
Paste your JavaScript into the input box and click Minify JS. The tool uses Terser to remove whitespace and comments, shorten names, and compress the code. Copy the smaller output for production. There is no signup and no upload — the minifier runs entirely in your browser.
UUID Generator creates random UUIDs (v4) and GUIDs online for free. Generate unique identifiers instantly for databases, APIs, and development. No signup needed.
Image to Base64 Converter encodes any image into a Base64 data URI online for free. Get ready-to-use CSS and HTML code in your browser.
JSON to YAML Converter changes JSON into clean YAML instantly online for free. Validate and convert config data in your browser with no upload.
Cron Expression Generator builds and explains cron schedules online for free. Create cron expressions with a plain-English description in your browser.
Image Resizer changes image dimensions online — set exact pixels, use percentage scaling, or pick from 12 presets (Instagram, Passport, YouTube, etc.). Target specific file sizes like 50KB or 100KB. Batch resize multiple images. 100% free, browser-based.
Image Converter changes images between any format online free — JPG, PNG, WebP, AVIF, PDF, ICO, BMP, HEIC, GIF, SVG. Batch conversion, resize, rotate, flip, AI format recommendation. 100% browser-based, no upload.
Convert JPG to WebP format online free — reduce image file size by 25-35% with identical visual quality. Batch conversion, adjustable quality, lossless mode available. Boost website speed and Core Web Vitals scores. 100% browser-based, no upload needed.
Convert PNG to WebP format online free — reduce file size by 26-34% while preserving full transparency. Batch conversion, lossless and lossy modes, adjustable quality. Boost website performance and Core Web Vitals. 100% browser-based, no upload needed.