# Minify JavaScript Code

> Minify JavaScript code by removing whitespace and comments to reduce file size. Nothing logged, nothing sent.

Live tool: https://lofttools.com/tools/dev-tools/js-minifier

Category: Dev Tools

## How it works

1. **Paste JavaScript** — Paste your JavaScript code into the input area
2. **Minify** — The code is minified automatically with size reduction displayed
3. **Copy result** — Copy the minified JavaScript or download as a file

## FAQ

### Are variable names renamed (mangled)?

No. This minifier does whitespace and comment stripping only — identifiers (`myVariableName`) pass through untouched. Variable mangling can change behaviour in code that uses `Function.prototype.name`, reflection, or stringified function bodies, so it's opt-in via a checkbox.

### What modern syntax is supported?

ES2024 and earlier — arrow functions, async/await, optional chaining, nullish coalescing, private class fields (`#name`), top-level await, import assertions. If the input is valid modern JavaScript, it parses cleanly; stage-3 proposals may parse but without guarantees.

### Does it strip `/*! license */` banner comments?

No. Comments starting with `/*!` (the widely-used license banner convention) are preserved verbatim at the top of the output. Regular `//` and `/* */` comments are removed.

## Privacy

This tool runs entirely in the browser. Files are not uploaded to a server. They never leave the user's device.

## More

- All tools: https://lofttools.com/tools
- Category: https://lofttools.com/tools/dev-tools
- LLM index: https://lofttools.com/llms.txt
