Back to home

JavaScript Minifier

Paste JavaScript to remove comments and unnecessary whitespace, then compare original size, minified size, savings, and syntax status.

Coding Waiting for result
Report issue

CodingBrowser only

Minify summary

Smaller JavaScript can help first load and cache efficiency. For production, still treat your project build and tests as the final check.

Syntax check

Syntax looks valid

Original size

292 B

Minified size

228 B

Bytes saved

64 B

Savings

21.9%

Gzip estimate

80 B

Lines removed

11

Source JavaScript

Paste JS code you want to shrink before deployment.

Minified output

Review the minified result, copy it, or download a .min.js file.

function calculateTotal(items){const total=items.reduce((sum,item)=>{return sum+item.price*item.quantity;},0);console.log("total",total);return total;}const cart=[{price:12,quantity:2},{price:5,quantity:3}];calculateTotal(cart);

Pre-deploy checklist

  • Preserve license comments when attribution is required.
  • Review regex-heavy and template-literal-heavy code after minifying.
  • Keep source maps and test results with production deployments.

Simple minifier note

This tool is for quick size reduction and review. Use your build pipeline for variable mangling, dead-code removal, and module bundling.

Minify JS with a safety check

This tool runs in the browser and does not upload code. It preserves strings and template literals while removing ordinary comments and unnecessary spacing.

Usage notes

  • Line and block comments are removed, while /*! ... */ license comments can be preserved.
  • Whitespace inside strings stays intact; code spacing is reduced.
  • Saving percent = (original size - minified size) / original size x 100.

Frequently asked questions

Is this the same as Terser?expand_more

No. It is a quick browser minifier. It does not rename variables, tree-shake, or deeply optimize code.

Is my code uploaded?expand_more

No. Everything happens in the browser.

How do license comments work?expand_more

Keep the preserve option on to retain important comments that start with /*!.

Keep exploring

More tools to try next

Jump into related tools from the same category and popular picks across Gogotem.

View all tools arrow_forward