Developer Tools

JavaScript Minifier

Minify JavaScript code for production.

How to Use JavaScript Minifier

1

Paste your JavaScript into the input area, or load a bundled .js file from your build output.

2

Choose between safe whitespace minification and aggressive mode, which also shortens literals and semicolons.

3

Click the "Process" button to strip comments and rebuild the script without unnecessary bytes.

4

Copy the minified output or download it, and always smoke-test it in your app before deploying.

Features

Safe mode removes only comments and whitespace, leaving names and behaviour untouched
Aggressive mode also shortens boolean literals and drops trailing semicolons
Never renames variables, so stack traces and debugging stay meaningful
Preserves regex literals, template literals, and string contents exactly as written
Reports original size, minified size, and the percentage saved
No install, no account, and nothing is uploaded to a server

Frequently Asked Questions

A bundler pipeline also performs mangling, dead code removal, and tree shaking, none of which this tool attempts. What you get here is the safe, predictable reduction in comments and whitespace, so the result is usually a little larger but guaranteed to behave like your source.
No. Identifiers are left exactly as written, which means your stack traces, function names, and console output still line up with the source you maintain. Renaming is the single biggest size win and also the single biggest source of production debugging pain.
The transformation is whitespace level, so it is safe, but any minified code should be smoke-tested after deployment. Run your test suite against the minified file, watch for console errors in staging, and keep the unminified original in source control.
It is free, requires no registration, and has no watermark or upload. Large bundles take a little longer to parse but there is no artificial cap.

About JavaScript Minifier

Whitespace and comments in a script are pure weight at runtime. The JavaScript Minifier parses your code, then re-emits it with those removed, so blocks collapse and statements join together where doing so is safe. A readable 200 KB script commonly lands around 120 KB before any compression, and considerably less after gzip.

There are two levels, and the difference matters. Safe mode only strips comments and redundant whitespace, leaving every identifier exactly as you wrote it. Aggressive mode additionally shortens the true and false literals, drops trailing semicolons where the grammar allows it, and normalises numeric and string forms. Neither mode renames variables, because renaming is the step that breaks stack traces and makes production debugging miserable.

The distinction from a real bundler is worth understanding. A tool such as terser also does mangling, dead code elimination, and function inlining, so it usually produces something smaller. This one does the predictable half of the job, which is the half you can eyeball and be confident is equivalent to what you wrote.

When to Use This Tool

  • Shrinking a script tag on a landing page before the main build pipeline exists
  • Reducing the size of a standalone widget or embed script
  • Preparing a snippet for a CMS that stores code as plain text
  • Trimming an inline script before pasting it into an email template
  • Comparing two versions of a script by minified size