DevKits

JavaScript Minifier — Compress JS Online, Free

Minify JavaScript online — remove comments, whitespace, and newlines. See byte savings. For production-grade minification (dead code, variable renaming), use Terser or esbuild. 100% local.

Last updated:

Comments

Strip JS comments and whitespace for a quick size estimate. For production minification, use Terser or esbuild.

Saved 39 bytes (28.9%)

Note: This is a basic whitespace+comment stripper. For production minification (dead code elimination, variable renaming), use Terser or esbuild.

function greet(name){const message = "Hello," + name + "!";console.log(message);return message;}

What is JS Minifier?

JavaScript minification removes comments (// and /* */), collapses whitespace, and removes unnecessary semicolons and newlines. This is a basic minifier — it does NOT perform dead code elimination, variable renaming, or tree shaking. For production-grade minification, use Terser, esbuild, or UglifyJS. This tool is useful for quick estimates and one-off compression of small scripts.

How to minify JavaScript

  1. 1Paste your JavaScript code.
  2. 2View the minified output and byte savings.
  3. 3For production deployment, use a dedicated minification tool (Terser, esbuild).

Frequently Asked Questions

Is this a production-grade minifier?

No — this is a whitespace+comment stripper. For production minification (dead code elimination, variable renaming, tree shaking), use Terser, esbuild, or UglifyJS. This tool is ideal for quick size estimates and one-off compressions.

How much does JavaScript minification save?

For well-commented, readable JS, expect 30-50% reduction. For already-compact code, 5-15%. Semantically meaningful characters (keywords, identifiers, operators) can't be removed without changing the program.

Can I use this for minifying bundled JavaScript?

Yes — paste the bundled output from webpack, Vite, or esbuild to further strip format whitespace. Combined with tree-shaking and bundling, total size reductions of 60-80% are achievable.

Try Next

Meta Tag Preview

Preview how your page will appear in Google search results and social share cards on Facebook, Twitter/X, and LinkedIn. Parses <title>, meta description, canonical, and full Open Graph / Twitter Card tags with diagnostics. 100% local.

Related Tools

Reference & Guides