Compress and optimize JavaScript

Web developers use JavaScript Minifier when preparing compact code for delivery or a controlled comparison.

Compress and optimize JavaScript and get compact code ready for the next step. Use it for free in your browser, with no account required.

How to use

  1. Paste the script you want to shrink into the input area, or load the file straight from your computer with the import button.
  2. Run the minifier: redundant spaces and line breaks are stripped out, which makes the file smaller.
  3. Copy the compact version to publish it, compare it or drop it into a page.
  4. Test the result before putting it live, because compact code is hard to read when something goes wrong.
  5. Always keep the original, more readable file for future maintenance.

Example

A typical situation: you are preparing a small script to embed in a page and want to cut the amount of data transferred. After minifying, check above all that the script still behaves exactly as before by running it in the browser console.

Limits and formats

Where processing happens

Compression happens in your browser on the script you provide. Nothing is sent to a third party and nothing stays behind once the tab is closed, which suits proprietary code you would rather not upload.

Frequently asked questions

Does minifying remove features?

It should not change how the script behaves, since it works on the layout of the code. Even so, test the output on a copy before replacing the file you use in production, and keep a backup until you are satisfied with the result.

Which files can I load?

The picker accepts .js, .mjs, .cjs, .ts, .tsx, .html, .css, .json, .sql and .graphql files among others, plus plain text. One file is processed at a time.

Why did my minified script stop working?

A misread string or a misplaced semicolon can turn into compact code that no longer runs. Go back to the original, test the script in the browser console and fix the part that raises an error.

Tools in the same category