メインコンテンツへスキップ
Tools Star Hub

JavaScript圧縮ツール

パーサーを使ってJavaScriptをブラウザ内で圧縮します。コードは実行されません。

ツールを読み込み中…

このツールはブラウザ内で動作します。入力内容、ファイル、生成した値はこの端末に残ります。お気に入りと最近使ったツールを利用する場合も、ローカルストレージに保存されるのはツール名だけで、パスワード、文書、QR コードの内容は保存されません。 詳しくはプライバシーポリシーをご覧ください。

このツールの詳しい解説(使い方、例、よくある質問)は、現在英語のみでご用意しています。

What this tool does

Parse JavaScript with Terser, then compress and mangle it. Use it when a small script should be shorter and you want a parser rather than find-and-replace. The script is not run, and TypeScript comes back as an error.

How to use

  1. Paste JavaScript into the left box.
  2. Press Minify. A parser compresses and mangles the source without running it.
  3. Copy the result or clear both boxes. Syntax errors are shown instead of output.

Examples

  • A small function

    function greet(name) { return "Hello, " + name; } is parsed, then shortened by removing whitespace and renaming locals where safe.

  • Invalid source

    If the parser cannot read the file, you get an error. The tool does not try to “fix” broken JavaScript.

How it works

JavaScript cannot be minified safely with simple find-and-replace. This tool uses Terser in the browser to parse the source, then compress and mangle it. Your code is not executed with eval or new Function. Constant-expression evaluation is turned off so user expressions are not run during minify. Very large files are rejected so the tab stays responsive.

Limitations

Terser parses the source, then compresses and mangles it. The script is not run. TypeScript, and JavaScript the parser cannot read, come back as an error rather than a shorter file. Constant expressions are not evaluated during the pass.

See the disclaimer for what these tools do not cover.

FAQ

Is the JavaScript Minifier free?
Yes. Parsing and minifying JavaScript in this browser is free, with no account.
Does this run my JavaScript?
No. The source is parsed and rewritten. It is not executed in this page.
Will every program minify?
Only syntactically valid JavaScript. Browser-incompatible syntax or truncated files will fail with a parser error.
Is my input sent to a server?
No. The source is minified in this tab. It is not uploaded and not saved in local storage.