convert

JavaScript Minifier

Shrink JavaScript by safely removing comments and whitespace, without renaming or rewriting code.

Runs on your deviceBatch readyPaste textNew

Line breaks are kept so automatic semicolon insertion still works. For aggressive minification use a bundler.

Paste or drop

Paste text below, or drop a file instead.

0 chars · 0 lines
…or drop a file
Drag and drop, or choose files
JSMJSCJSTXT

Choose an output

Shrink JavaScript by safely removing comments and whitespace, without renaming or rewriting code.

Fine-tune

Optional — sensible defaults are already set.

About JavaScript Minifier

This minifier removes comments and unnecessary whitespace from JavaScript while leaving the code itself alone: no variables are renamed and no expressions are rewritten. It tokenizes strings, template literals and regular expression literals so their contents are never changed.

When it helps

  • Shrinking a small script or bookmarklet that is not part of a bundler setup.
  • Removing comments from a snippet before embedding it in an HTML page or analytics tag.
  • Getting a quick size reduction without the risk of a mangling minifier changing behavior.

Tips

  • Line breaks are kept so automatic semicolon insertion still works. This makes the output safe for code written without semicolons, but larger than a full minifier's.
  • /*! license */ comments are preserved by default. Turn the option off to remove them.
  • For production bundles, a tool such as esbuild, Terser or SWC will shrink code much further by renaming variables and removing dead code.

Good to know

Quick answers about javascript minifier in your browser.

JavaScript inserts semicolons automatically at some line breaks. Joining everything onto one line could change meaning in code that omits semicolons, so line breaks are kept to stay safe.

It is designed for plain JavaScript. Compile TypeScript or JSX to JavaScript first, then minify the result.

Yes. There is no sign-up, no watermark and no limit on how many files you process.

No. Files are read and processed locally in your browser, so they never leave your device.

Related tools