Zero Signup ToolsFree browser tools

Developer Tools

JS Minifier

Minify JavaScript in your browser. Strip comments, collapse whitespace, and tighten punctuation safely. Strings, templates, and regex literals are preserved.

JavaScript minifier

0 B

Optimization options

Statement-level line breaks are preserved so automatic semicolon insertion (ASI) cannot change the meaning of the output. Strings, template literals, and regex literals are passed through verbatim.

Your JavaScript is minified entirely on your device. Nothing is uploaded.

How to use

  1. Paste your JavaScript into the input area on the left, or click Load sample to try the minifier on an example file.
  2. Toggle the optimization options on the right: remove comments, preserve /*! important comments, collapse whitespace, collapse blank lines, and tighten punctuation.
  3. Read the minified output on the right with live byte size, savings, and reduction percentage. The output updates as you type or change options.
  4. Click Copy JS to copy the minified code, or Replace with minified to load the result back into the input for another pass.

About this tool

JS Minifier is a browser-based JavaScript minifier built around a state-machine tokenizer that knows the difference between code and literal data. Strings (single, double, and backtick), template literal expression bodies, regex literals (with full character-class and flag support), and line and block comments are each detected as separate tokens, so the optimizer never touches the inside of a string, a template, or a regular expression. The minifier is intentionally conservative: by default it strips comments (optionally preserving important comments that begin with /*!), collapses runs of intra-line whitespace into a single space, collapses runs of blank lines, trims leading and trailing whitespace on every line, and tightens spaces around safe punctuation (parentheses, brackets, braces, commas, semicolons, and colons) but only where doing so cannot merge two identifier characters. Crucially, statement-level line breaks are preserved so the engine's automatic semicolon insertion (ASI) cannot change the meaning of the output. That is the difference between a safe minifier and a destructive one: a naive 'strip all whitespace' approach can turn a return on its own line followed by an object literal on the next line into a return of undefined, but this tool keeps the structural newlines intact. Toggle each optimization independently to balance file size against readability, use the live byte counter and reduction percentage to see how much you saved, and copy the result with one click. Useful for shrinking inline script tags, bookmarklets, GitHub Pages widgets, JSFiddle and CodePen exports, embed snippets, and any quick production copy where pulling in a full build toolchain is overkill. Everything runs locally in your browser using built-in tokenizer logic, so the source code you paste here, including any API keys or proprietary algorithms, never leaves your device.

Free to use. Works in your browser. No signup, no login.

Related tools

You may also like

All tools
All toolsDeveloper Tools