Shiklo Tools
PDF40
Image20
Calculators & Converters25
Text & Writing13
Developer26
Video14
Audio14
Document14
Data & Spreadsheet12
Web & SEO9
OCR & Scanning5
Archive & File12
Security & Privacy23
Health & Medical29
QR & Barcode5

JavaScript Minifier

Minify JavaScript with Terser: remove whitespace and comments, shorten local names and compress code, with syntax errors shown by line.

JavaScript is often the largest part of a web page, and every kilobyte has to be downloaded, parsed and compiled before it runs. Minifying it removes what the engine doesn't need — comments, whitespace and line breaks — and goes further by renaming local variables and function parameters to single letters and simplifying code where the result is guaranteed to behave the same.

This tool uses Terser, the minifier inside webpack, Rollup, Vite and many other build tools, so the output is what professional build pipelines produce. Paste a script or an ES module, choose whether to compress and shorten names, and keep licence comments if you need them. You see the size saved, and syntax errors are reported with line and column. Your code never leaves your browser.

How to use JavaScript Minifier

  1. Paste JavaScript, open a .js or .mjs file, or press Sample.
  2. Choose Script or ES module.
  3. Choose compression, name shortening and whether to keep licence comments.
  4. Copy the minified code or download it as a .min.js file.

Features

  • Minification with Terser, as used by major build tools.
  • Scripts and ES modules.
  • Compression: dead code removal, shorter expressions.
  • Shortens local variable and parameter names.
  • Keeps /*! and @license comments if you want.
  • Syntax errors with line and column.
  • Runs in your browser; code is never uploaded.

Why minify JavaScript

Smaller scripts download faster, and the browser spends less time parsing them, which matters most on mid-range phones where JavaScript processing is often the slowest part of loading a page. Minification also removes comments that may describe internal details you would rather not publish, such as notes about unfinished features or internal endpoints.

What the options do

Each option trades a little readability for size. All of them keep the code's behaviour the same for valid JavaScript.

OptionEffect
CompressRemoves unreachable code, joins declarations, simplifies conditions and constant expressions
Shorten namesRenames local variables and parameters to short names; global and exported names stay
Keep licence commentsKeeps comments starting with /*! or containing @license or @preserve
ES moduleAllows import and export and treats the code as strict mode with its own scope

Scripts and modules

Choose Script for classic code loaded with a plain script tag, where top-level names are global and may be used by other scripts on the page — those names are never shortened. Choose ES module for code that uses import and export or is loaded with type="module"; modules have their own scope, so Terser can shorten top-level names that are not exported, giving better results. Code written for one mode may fail in the other, for example import statements in a script, which the tool reports as an error.

When minified code breaks

Terser is careful, but some code depends on things minification can change. Code that reads function names at run time, for example to register classes by name, can break when names are shortened — turn Shorten names off for such code. Code that relies on eval or with blocks prevents some optimisations. Always test the minified file before publishing, and keep the original: minified code is very hard to read or debug. Build tools usually also produce a source map that lets developer tools show the original code; this quick tool does not create source maps.

Private and quick

Terser runs on your device, so proprietary code, API logic and unreleased features stay private. For production websites, minifying as part of your build is the right approach; this tool is ideal for one-off jobs such as bookmarklets, snippets for a CMS or tag manager, small widgets, browser extensions, or checking how much a file would shrink. To make minified code readable again, the JavaScript Formatter lays it out cleanly, although shortened names cannot be restored.

Frequently asked questions

How do I minify JavaScript?

Paste the code or open a file; the minified version appears. Copy it or download it as .min.js.

Which minifier is used?

Terser, the open-source minifier used by webpack, Rollup and Vite.

Will minifying break my code?

Not for valid code in normal use. Code that depends on function names should be minified without shortening names.

Does it support ES modules?

Yes. Choose ES module for code with import and export.

Are licence comments kept?

Yes, if Keep licence comments is on.

Is my code uploaded?

No. Minification runs entirely in your browser.

Can I unminify JavaScript?

The JavaScript Formatter makes it readable, but shortened names and removed comments cannot be restored.

Related tools