MinifyPic

JavaScript Minifier

Strip comments and whitespace out of JavaScript to make it smaller and faster to download.

FreeInstantNo upload
Loading tool…

How it works

A compact workflow from input to download.

1

Paste your JavaScript

Drop in a script of any size.

2

Minify it

Comments and unnecessary whitespace are removed while the code's behaviour stays exactly the same.

3

Copy the output

Copy the minified script and keep your original source for editing.

Frequently asked questions

Does this mangle variable names?
No. This tool removes comments and whitespace, which is safe and reversible in effect. It does not rename variables or restructure code — that is the job of a full compiler-based minifier like Terser or esbuild, which can shrink code substantially further but needs to parse the language properly to do it safely.
How much smaller will my code get?
Typically 20 to 50 percent for heavily commented source. A full minifier that also shortens local variable names and removes dead code will do considerably better than that, particularly on large codebases.
Will minified code still work?
Yes — removing comments and whitespace cannot change program behaviour, with the single exception of code that depends on reading its own source text, which is vanishingly rare and generally a bad idea anyway.
Should I minify by hand for production?
For a serious project, no — use a build tool. Terser, esbuild and the bundlers that wrap them do everything this tool does and much more, automatically, every time you build. This tool is for the one-off case: a standalone script, a snippet you need to paste somewhere with a size limit, or a quick check of how much a file would shrink.
Is my data sent to a server?
No. Everything runs in JavaScript inside your own browser tab — nothing is uploaded, logged or stored. That is what makes it safe to paste in API responses, config files, tokens and other material you could not send to a third-party service.

JavaScript is the most expensive thing you ship

Byte for byte, JavaScript costs a browser far more than any other resource. An image of a given size must be downloaded and decoded, and that is largely it. A script of the same size must be downloaded, parsed into a syntax tree, compiled, and then executed — and on a mid-range phone, that parse-and-compile step can take several times longer than the download did. This is why a site can score well on raw network metrics and still feel sluggish: the phone is not waiting for bytes, it is burning CPU on them. Reducing script size therefore pays twice, cutting both transfer time and processing time, and it is the reason performance work on modern sites so often reduces to shipping less JavaScript.

What a real minifier does that this does not

Stripping comments and whitespace is the easy half. A proper minifier parses the code into an abstract syntax tree and then applies transformations that require actually understanding the language: renaming local variables to single letters, since their names are invisible outside their scope; removing code that can be proven unreachable; inlining functions used only once; collapsing constant expressions; and shortening boolean and conditional constructs. Bundlers add tree-shaking on top, discarding exported functions that nothing imports. The combination routinely halves a bundle again beyond what whitespace removal achieves. The trade is that it must parse the language perfectly to stay safe, which is exactly why you use a well-tested tool for it rather than a regular expression.