JavaScript Minifier

Strip comments and whitespace from JavaScript to ship smaller files.

Free · No sign-up · Runs locally in your browser · Also available in Chinese (中文)

Open JavaScript Minifier →The tool interface is in Chinese, but usage is universal — inputs, files and outputs need no translation. Click to open it in the same tab.

What is JavaScript Minifier?

A JavaScript minifier rewrites source code into the smallest equivalent form: comments removed, unnecessary whitespace collapsed, and where safe, variable names shortened. The browser executes minified code identically — it is purely a transport optimization.

Smaller files mean faster page loads, especially on mobile networks where every kilobyte counts. This tool runs the minification in your browser, so proprietary code never leaves your machine — an important consideration when many online minifiers quietly upload your source to their servers.

How to use it

  1. 1Paste your JavaScript source into the input area.
  2. 2Click minify — the compact output appears beside it.
  3. 3Check the size savings reported for the original versus minified code.
  4. 4Copy the minified result or download it as a .js file.

Common use cases

  • Preparing a small standalone script for direct embedding in a page.
  • Reducing a bookmarklet or userscript to the smallest possible size.
  • Learning what production bundlers do to code by seeing the transformation clearly.

Frequently asked questions

▸Can minified code be restored to readable form?

Formatting can be beautified back, but original variable names and comments are gone forever — that is why you always minify a copy and keep the readable source in version control.

▸Is it safe for all JavaScript?

For standard scripts, yes. Code that relies on exact formatting — eval'd strings, function.toString() checks — should be tested after minification.

Related code tools

搜索工具

按名称或关键词搜索全部工具