JS Minifier

Minify JavaScript in the browser by stripping comments, whitespace, and unneeded spaces around operators.

Input JavaScript

Processed JavaScript
Click 'Minify JS' to process code.
  1. Paste your JavaScript into the input box.
  2. Click "Minify JS" to remove comments and whitespace, or "Format JS" for a quick expanded view.
  3. Check the original size, minified size, and percentage saved.
  4. Copy the output or download it as app.min.js.
  • Lightweight comment and whitespace compaction
  • Shows original vs minified byte count
  • Zero server uploads for maximum privacy

What does this JavaScript minifier do?

It removes // and /* */ comments, collapses whitespace and line breaks, and strips spaces around operators and punctuation. It does not rename variables or remove unused code the way full build tools do.

Is it safe to use on any JavaScript code?

It's a lightweight, text-based minifier that works well for small scripts and snippets written with semicolons. Code that relies on automatic semicolon insertion, or that contains regular expressions or strings with comment-like text, can break when line breaks are removed. Always test the output, and use a parser-based tool such as Terser, esbuild, or SWC for production bundles.

Does minifying protect my source code?

No. Minification only makes code smaller. Anyone can reformat minified JavaScript and read it, so never put secrets such as API keys in client-side code.