HCODX / JS Minifier
100% browser-based · powered by Terser

JavaScript Minifier — Minify JS Online

Optimize your JavaScript code instantly. Remove unnecessary whitespace, comments, and dead code to reduce file size and improve page loading speed. Perfect for Core Web Vitals and Google PageSpeed.

Drop JavaScript file
or click to browse — accepts .js
original.js
minified.js
Minification Options
Original Size
0 B
Minified Size
0 B
Size Reduction
0%
Bytes Saved
0 B
500K+
Files Minified
70%
Average Reduction
35K+
Happy Developers
4.9 / 5
User Rating
Example

See the difference minification makes

A simple before/after — comments, whitespace, and verbose names get compacted while behavior stays identical.

Before — readable source
// Calculate the order total with optional tax
function calculateTotal(price, quantity, tax) {
  const subtotal = price * quantity;
  if (tax) {
    return subtotal * (1 + tax);
  } else {
    return subtotal;
  }
}

document
  .getElementById('calculateButton')
  .addEventListener('click', function () {
    const result = calculateTotal(29.99, 3, 0.08);
    console.log("Total price:", result);
  });
~ 462 B
After — production-ready
function calculateTotal(n,t,a){const l=n*t;return a?l*(1+a):l}document.getElementById("calculateButton").addEventListener("click",function(){const t=calculateTotal(29.99,3,.08);console.log("Total price:",t)});
~ 218 B · 53% smaller
Use cases

Built for shipping fast frontends

From WordPress sites to React bundles, minification is the cheapest performance win you can ship.

WordPress optimization

Minify theme and plugin JavaScript files to improve load times by up to 40%. Pair it with CSS minification for compounded gains.

E-commerce performance

Reduce cart abandonment by improving page speed. A one-second delay can cost up to 7% of conversions on a checkout flow.

React, Vue & Angular apps

Trim bundled output beyond what your default Webpack or Vite config produces — perfect for vendor chunks or third-party scripts.

Mobile & emerging markets

Smaller payloads matter most where bandwidth is limited. Minified scripts mean faster Time-to-Interactive on slow connections.

Why HCODX

How our minifier compares

A focused alternative to CLI tooling — same Terser engine, zero install, instant feedback.

Feature HCODX JS Minifier UglifyJS Terser CLI Closure Compiler
Free to use
No installation needed
Dead code elimination
Variable name mangling
ES2020+ support
Real-time size insights
Drag & drop file upload
100% client-side privacy
Step by step

How to minify JavaScript

From paste to production in under 30 seconds.

1

Paste or upload your JavaScript

Drop a .js file into the upload area or paste your source into the left editor. Click the magic-wand to load a sample if you just want to try it.

2

Configure minification options

Toggle whitespace removal, comment stripping, dead-code elimination, console removal, or property mangling. For maximum compression, enable all options.

3

Run the minifier

Click Minify JavaScript. Terser runs entirely in your browser — usually instant, even for large files. Check the stats panel for the size reduction.

4

Copy or download the result

Copy the minified code to clipboard or download it as minified.js. Drop it into your build output, CDN, or production bundle.

FAQ

Frequently asked questions

Everything you might wonder about how JavaScript minification works.

JavaScript minification removes all unnecessary characters from source code without changing how it runs:

  • Whitespace, line breaks, and comments are stripped
  • Variable names are shortened
  • Unused code is eliminated
  • Expressions are collapsed where possible

The result is typically 40–70% smaller, which means faster downloads, better Core Web Vitals, lower bandwidth costs, and improved SEO. Google PageSpeed Insights specifically flags unminified JavaScript as an opportunity for improvement.

Yes. This tool is built on Terser, the same engine used by Webpack, Rollup, Vite, and Next.js for production builds. The semantic meaning of your code is preserved.

That said, debugging minified code is harder, so always keep your original source under version control. For production debugging, generate source maps in your build pipeline.

  • Minification changes the source code itself — whitespace, comments, and long names are gone permanently in the file you ship.
  • Compression (GZIP / Brotli) is applied at the server level, transparently, and the browser decompresses on the way in.

The two are complementary: minify first, then let your CDN or web server apply Brotli. The combination can shrink payloads by up to 90% versus the original source.

The minifier is safe with all popular frameworks — jQuery, React, Angular, Vue, Svelte, and others. They were designed with minification in mind.

If you rely on globally-exposed names (e.g. inline event handlers calling myFunc() from HTML), be careful with Mangle properties. You can:

  1. Disable the Mangle option
  2. Namespace globals on a single object (e.g. window.app)
  3. Bundle related scripts together before minifying

Typical improvements based on industry benchmarks:

  • File size: 40–70% smaller
  • Time to Interactive: 300–800 ms faster
  • PageSpeed score: +5 to +15 points
  • Mobile rendering: 15–25% faster

Amazon famously found that every 100 ms of latency cost 1% in sales — performance is a business metric, not just a technical one.

Bundle first, then minify. The minifier can perform cross-file optimizations and eliminate more unused code when it sees everything at once.

That said, with HTTP/2 and modern code splitting, keeping critical chunks separate makes sense for caching and progressive loading. Build tools like Webpack, Rollup, Vite, and Parcel handle the order automatically.

Re-minify every time your source changes. The best practice is to make minification part of your build or CI pipeline — Webpack, Vite, esbuild, GitHub Actions, etc. — so you never ship an unminified file by accident.

Re-evaluate your minification strategy roughly once a year to take advantage of new optimization techniques.

Yes. Google specifically flags unminified JavaScript in PageSpeed Insights, and Core Web Vitals are a confirmed ranking factor. Mobile-first indexing makes JavaScript size matter even more on lower-powered devices.

Since the May 2021 Page Experience update, performance is explicitly part of how Google ranks pages.

About

About JavaScript minification

JavaScript minification is the process of removing every unnecessary character from your source code without changing how it executes. It's one of the highest-leverage performance optimizations you can ship, and it's expected for any production deployment in 2026.

What gets removed

  • Comments — useful for developers, irrelevant to the runtime
  • Whitespace — spaces, tabs, and newlines that aid readability but aren't required
  • Long identifiers — descriptive variable names get replaced with single characters
  • Dead code — branches and variables that can never execute
  • Verbose expressions — collapsed and inlined where it's safe

Benefits at a glance

  • Smaller files — typically 40–70% reduction
  • Faster page loads — less to download, parse, and execute
  • Lower bandwidth costs — for you and your visitors
  • Better SEO — Core Web Vitals are a ranking signal
  • Improved mobile UX — especially on slow connections

When to use minified JavaScript

Always in production. Never in development — debugging minified code is painful, and you lose the value of meaningful stack traces. The standard workflow is to ship minified code with a source map alongside it, so production errors map back to your original source.

Best practices

  • Keep your original source under version control
  • Generate source maps for production debugging
  • Test minified output before deploying — especially when enabling Mangle properties
  • Automate minification in your build pipeline (Webpack, Vite, esbuild, Rollup)
  • Combine minification with HTTP compression (GZIP / Brotli) at the server
  • Serve minified bundles from a CDN with long-lived cache headers