Skip to tools

Minifiers

JavaScript Minifier

The JavaScript Minifier performs a basic minification: it removes comments, line breaks and redundant spaces to make scripts smaller. It is designed for quick jobs such as compacting a bookmarklet or an inline script.

For large applications a full bundler is still recommended, but for snippets this tool is instant and private.

How to use the JavaScript Minifier

  1. 1Use the JavaScript Minifier right on this page, or open the full workspace for history, sharing and every other tool.
  2. 2Paste your input, upload a file, or drag and drop a file onto the input box (up to 25 MB).
  3. 3The result appears in the output panel automatically and updates when you change the input or an option.
  4. 4Use Copy Output or Download to save the result. Nothing is uploaded to a server.

Example

Comments and line breaks are removed from a small function.

Input
// greet
function hi (name) {
  return "Hi " + name;
}
Output
function hi(name){return"Hi "+name}

When to use it

  • Creating a compact bookmarklet from a readable script
  • Shrinking an inline analytics or widget snippet
  • Preparing a small script for a CMS field with a length limit

Tips and common mistakes

  • Always test minified code — missing semicolons can change behaviour when lines are joined.
  • Variable names are not shortened in this basic mode.
  • Keep the readable original under version control.

Frequently asked questions

Does it rename variables?

No. Only whitespace and comments are removed, which keeps the code safe and predictable.

Is my code uploaded?

No. Minification happens locally in your browser.

TutorialHTML, CSS and JavaScript beautification: a quick tour

Related tools

Ready to try it?

Free, no sign-up, and your data never leaves your browser.