JustUtils
Runs locally in your browser

Minify JavaScript Online

Compress valid JavaScript with a real parser, see the exact byte reduction, and download a production-ready .min.js file.

1. Add JavaScript

Paste code or import one file. Maximum size: 2 MB.

0 B
Compression options

Shortcut: Ctrl/⌘ + Enter · Code is parsed, never executed.

Smaller code, clear trade-offs

Minify JavaScript without guessing what the controls change.

JavaScript minification reduces transfer and parse size by removing optional syntax and applying safe optimizations. This page uses Terser, a parser-based minifier, rather than regular expressions that can mistake comment-like text inside strings, template literals, or regular expressions for removable code.

  1. 01

    Add valid JavaScript

    Paste a script or import a .js, .mjs, or .cjs file up to 2 MB. TypeScript and JSX need compilation first.

  2. 02

    Review the options

    Keep license notices by default. Preserve function and class names when runtime code or stack traces depend on them.

  3. 03

    Test the minified file

    Download the result, replace it in a test build, and verify behavior before deploying it to production.

Worked examples

These small examples show the exact transformation, including the characters that are easy to overlook.

Remove formatting and simplify a function

Input
function double(value) { // Return twice the value return value * 2; }
Result
function double(n){return 2*n}

Whitespace and the ordinary comment disappear. The local parameter can be shortened because it is only used inside the function.

Preserve text that looks like a comment

Input
const url = "https://example.com/a//b"; const pattern = /https?:\/\//;
Result
const url="https://example.com/a//b",pattern=/https?:\/\//;

A real JavaScript parser knows that // inside a quoted URL or regular-expression literal is data, not a line comment.

Understand the format

Minification is compression, not encryption or bundling.

A minifier removes comments and optional whitespace, rewrites expressions into shorter equivalents, drops unreachable or unused local code when safe, and can shorten local identifiers. The browser still receives JavaScript, so minification does not hide secrets or protect source code from determined readers.

Bundling is a separate job: it follows imports and combines modules. Transpilation is also separate: it converts TypeScript, JSX, or newer syntax for a chosen browser target. This online tool minifies one already-valid JavaScript input and does not invent a build configuration.

Network compression such as Brotli or gzip should normally be enabled as well. Minification and transfer compression complement each other: minification removes syntax-level waste, while Brotli or gzip finds repeated byte patterns during delivery.

Useful for

  • Compressing a standalone JavaScript snippet or a small file before publishing it.
  • Comparing output size with and without local-name shortening.
  • Checking a syntax error before moving code into a larger build pipeline.

Check before you copy

  • Never place API keys, passwords, or private data in client-side JavaScript. Minification is reversible enough to expose them.
  • Keep function and class names when code reads .name or when readable production stack traces matter.
  • Run automated tests against the exact minified artifact; valid syntax alone cannot verify application behavior.
  • Use source maps from your production build pipeline when you need original files and line numbers during debugging.

Common questions

Answers for first-time users

Is this JavaScript minifier free and private?

Yes. The minifier runs in your browser with no account, upload, quota, or watermark. Pasted code and imported files stay on your device.

Will minifying change how my JavaScript works?

Terser parses the program before optimizing it and is designed to preserve behavior. Still test the result in your application, especially when code reads function names, class names, or relies on unusual build assumptions.

What does shortening local names do?

It replaces local variable and parameter names with shorter names to save more bytes. Public property names are not normally changed, but code that inspects fn.name or class names may need the Keep function/class names option.

Does this tool support ES modules and modern JavaScript?

Yes, it accepts modern JavaScript syntax and import/export statements. It does not compile TypeScript or JSX, bundle separate modules, or transpile new syntax for older browsers.

Should I keep license comments?

Usually yes. The default preserves recognized comments such as /*! ... */, @license, @preserve, and @cc_on. You remain responsible for following every dependency license in the code you distribute.

Is an online minifier a replacement for a build pipeline?

It is useful for a snippet or standalone file. For an application, use minification inside a tested bundler workflow so source maps, chunking, transpilation, caching, and repeatable builds stay connected.