TL
Tool Lab
💰Donate
💰Donate

JavaScript Minifier

Minify and compress JavaScript

Input JavaScript
Minified JS

About This Tool

JavaScript minification removes comments, whitespace, newlines, and other non-essential characters from source code without changing its behavior. The result is a smaller file that downloads and parses faster in the browser.

This tool handles common cases: single-line comments (//), block comments (/* */), string literals (preserved exactly), and operator spacing. For production use, dedicated tools like Terser or esbuild additionally rename variables and apply dead code elimination — features beyond the scope of a browser-based tool.

How to Use

  1. Paste your JavaScript into the input panel.
  2. Click the Minify button.
  3. The minified output appears on the right with a size savings indicator.
  4. Use the Copy button to copy the result to your clipboard.

Use Cases

Used to reduce script size before production deployment. Useful when you need to embed inline scripts in HTML without a build tool. Also handy for optimizing a single script file in WordPress or legacy systems, or quickly compressing a small utility script.

FAQ

  • Does minification change code behavior?No. Minification is semantically neutral — only comments and whitespace are removed; logic remains identical.
  • How does this differ from Terser/esbuild?Terser and esbuild additionally shorten variable names, eliminate dead code, and fold constants. This tool is a quick browser-based option with no build environment required.
  • Are regex literals handled correctly?Simple regex literals are preserved. Complex regex may occasionally not be handled correctly — check the output when in doubt.