JavaScript Minifier

Free

Minify JavaScript code by removing whitespace and shortening variable names

Minified
function add(a,b){return a+b;}const x=add(1,2);

About JavaScript Minifier

Shipping less JavaScript means faster pages, and source code is full of whitespace, comments, and descriptive variable names that the engine doesn't need at runtime. This JavaScript Minifier compresses your code by removing those extra characters and shortening variable names where it's safe, producing a much smaller file that behaves identically.

Paste your script and the tool returns minified output instantly. It's free, runs in your browser, and needs no signup. Use it to reduce the size of a script before deployment, compress a utility you're embedding, or cut bundle weight without a dedicated build step, lowering download size so your code reaches users and starts running faster.

Common uses

  • Reduce a script's size before deployment by stripping whitespace and shortening names
  • Compress a utility or library before embedding it in a page
  • Cut bundle weight quickly without configuring a build tool
  • Minify a widget script distributed to third-party sites
  • Further shrink a build output before it goes to production

How to use

  1. 1

    Configure options

    Set your preferences using the options panel below.

  2. 2

    Click Generate

    Click the process button to generate your result instantly.

  3. 3

    Copy or download

    Copy the result to clipboard or download it directly to your device.

Why ToolHub?

  • Clean readable code
  • Standards-compliant formatting
  • One-click beautify

FAQ

What does this minifier do to my code?

It removes whitespace and comments and shortens local variable names where safe, keeping the code's behavior intact.

Does shortening names break anything?

Local names are renamed safely, but code that depends on specific names through strings or reflection should be tested after minifying.

Can I recover the original code?

Not fully. Comments and original names are lost. The JavaScript Formatter can restore indentation but not the original naming.

Why minify JavaScript at all?

Smaller scripts download and parse faster, which directly improves how quickly your page becomes interactive.

Can I use JavaScript Minifier on mobile?

Yes — ToolHub is fully responsive and works on iPhone, Android, tablets and all modern browsers. No app install needed.