JavaScript Minifier

Reduce JavaScript size by safely removing comments and whitespace. Your code is processed as text in your browser — it is never executed or uploaded.

FreeNo sign-upRuns in your browserMobile-friendly

Loading tool…

Need help with this tool or found a problem? WhatsApp support Email

What does the JavaScript Minifier do?

This minifier uses a tokenizer that understands strings, template literals (including nested ${…}), regular-expression literals and comments, so it never breaks code by removing something inside a string. Line breaks are kept wherever JavaScript’s automatic semicolon insertion might depend on them, which keeps code without semicolons working.

It does not rename variables or remove dead code. For maximum compression in production, use a build tool such as esbuild or Terser; this tool is ideal for quick snippets, bookmarklets and inline scripts.

How to use the JavaScript Minifier

  1. Paste your JavaScript.
  2. Choose whether to keep /*! license */ comments.
  3. Copy or download the minified code and check the saving.

Examples

Snippet

A 20-line function with comments typically shrinks by 30–50% without changing behaviour.

Common use cases

  • Inline scripts in HTML pages
  • Bookmarklets
  • Quick optimisation of small libraries

Features and benefits

  • Private by design — your data is processed on your device and never uploaded.
  • Free with no account, no watermark and no usage limits.
  • Works on phones, tablets and desktops in any modern browser.

Limitations to know

  • No variable renaming or tree-shaking.
  • Unusual syntax (such as a regex directly after a closing brace) may be misread; test the output.

Frequently asked questions

Will minified code run the same?

It is designed to, and keeps line breaks where they matter. Always test before deploying.

Why is the result not as small as Terser?

Terser also renames variables and removes unused code, which requires a full parser.

Is my code executed?

No, it is only processed as text.

Embed this tool on your website

Add the free JavaScript Minifier to your blog or website. Paste the code into your page’s HTML; the tool runs in your visitors’ browsers and stays up to date automatically. Please keep the credit line below the tool.

Free to use on any website. The tool runs inside an iframe served from viptools.pk; nothing your visitors type is sent to your site or ours. Preview the embedded version.