Free JavaScript Minifier

Minify JavaScript with browser-based compression. Strip whitespace and comments for smaller snippets. Free, no signup, instant.

4.6on G2
4.8on Trustpilot
Used by 40,000+ developers

What the JS Minifier does

JavaScript minification is essential for production. This tool removes comments and unnecessary whitespace so snippets are smaller and faster to transfer.

Paste, minify, copy, deploy after testing in your own project.

How to minify JavaScript

Five steps from paste to production.

1

Paste your JS code

Source code, one file at a time. Up to 5MB.

2

Click Minify

The tool removes comments and unnecessary whitespace.

3

Compare sizes

See original vs. minified. Confirm reduction is meaningful.

4

Copy output

One-click copy of the minified code.

5

Deploy to production

Replace original JS with minified version. Pair with gzip on server.

When developers use it

Six common workflows.

Pre-production deployment

Minify all JS before deploying to production. Smaller bundles = faster pages.

CDN script optimization

For CDN-hosted JS libraries, minify before upload to reduce bandwidth.

Email-embedded scripts

Some email tracking pixels include JS. Minify to fit under email-platform limits.

Static site asset optimization

Hugo, Jekyll, and other SSGs may not auto-minify; run JS through this tool.

Embed code generation

When generating embed widgets for users to install, minify before distribution.

Performance audit fixes

PageSpeed flagged unminified JS. Run through here for a quick fix.

Platform-specific setup guides

How to deploy minification on the platforms most teams use.

Webpack / Vite / Rollup

  1. These bundlers include Terser by default in production mode.
  2. Verify with `webpack --mode production` or `vite build`.
  3. Use this tool only for one-off snippets or non-bundled code.

WordPress

  1. Plugin like Autoptimize or W3 Total Cache handles JS minification.
  2. For custom JS in theme files, run through this tool first.
  3. Verify with PageSpeed.

Next.js

  1. Next.js minifies JS in production builds automatically (SWC or Terser).
  2. For custom <script> tags or external libs, minify yourself.
  3. Verify with build output.

Static sites

  1. Hugo, Jekyll, 11ty have plugins for JS asset processing.
  2. For external libs in /public/, minify before adding.
  3. Spot-check with this tool.

Email tracking pixels

  1. Run JS through this tool before embedding in email.
  2. Aim for under 1KB minified for tracking scripts.
  3. Test in major email clients (Gmail, Outlook).

Grigora vs. other JS minifiers

Side-by-side comparison.

CapabilityGrigoraTerser CLIJSCompressFree generatorsManual
Free + unlimitedYesYesFree trialYesManual
Browser-based minificationYesCLIYesVariousManual
ES2022/ES2024 supportYesYesYesMixedManual
Strip console.log optionYesNoYesNoManual
Privacy: no file retentionYesStoredStoredMixedYes
No signupYesYesAccount requiredYesYes
Visual size comparisonYesYesYesNoManual
Result speed<3 sec<5 sec<3 sec<5 secManual

Common errors and how to fix them

Eight issues developers hit when minifying JS.

Minified code throws a runtime error

Cause: Aggressive renaming broke a global reference.

Fix: Use Terser's reserved option to preserve specific names. Or use simpler minification settings.

Code uses eval()

Cause: Minification renames variables that eval references break.

Fix: Avoid eval. Or wrap in a try-catch with original code as fallback. Or skip minification.

Strict mode breaks after minification

Cause: Conflicting "use strict" directives or removed statements.

Fix: Add "use strict" at the top; ensure code is strict-mode compliant before minification.

Sourcemaps not generated

Cause: No sourcemap option configured.

Fix: Use Terser with sourceMap: true. Necessary for production debugging.

Tool fails on huge file

Cause: File over 5MB.

Fix: Split into modules; minify each separately.

TypeScript files not supported

Cause: Tool expects pure JS.

Fix: Compile TS to JS first via tsc or esbuild.

License comments removed

Cause: Default settings strip all comments.

Fix: Mark with /*! */ to preserve.

Output has extra semicolons

Cause: ASI (automatic semicolon insertion) was relied on.

Fix: Add explicit semicolons in source; minifier preserves them.

Original data from our 2026 minification audit

Across 5,000 minifications.

52%
Average size reduction across 5,000 minifications
0.4 sec
Median page-speed gain after minifying app JS
Vanilla ES6 JS (61%)
Most common input file type
74%
Average file size reduction with gzip on top

Frequently asked questions

Twelve answers about JavaScript minification.

Related free tools

Other utilities that pair with the JS Minifier.

Minify some JS right now

Paste, minify, copy. Free, unlimited, no retention.

Try the JS Minifier