JS Minifier

Shrink JavaScript files by removing spacing and dead characters.

or drag & drop files here (.js, .mjs, .cjs, .jsx) — several files are joined in order. Read in your browser, never uploaded.
Minified JS
Paste, upload or load JS code to minify...

Only comments and spaces that cannot change the result are removed; text inside strings, templates and regular expressions is kept exactly. Licence comments (/*! … */) are kept. Variable names are not shortened, so the code stays readable in error messages.

Website Management Tools

About the JS Minifier

The JavaScript Minifier shrinks your script by removing comments, spaces and line breaks. You can paste the code or load a file, then copy or download the smaller version. Scripts are often among the heaviest files on a page, so this is a useful step for hand-written code.

Less code means a shorter download. Browsers must also parse and run JavaScript, which can slow down phones, so trimming your scripts helps, though removing scripts you do not need helps much more.

It removes only comments and spacing that cannot change the result, and text inside strings is left alone. It does not rename variables or restructure code like a full build tool, so the saving is smaller. Always test the result on your site before you replace a working script.

How to use this tool

  1. 1Paste your JavaScript or load your file.
  2. 2Copy or download the minified code.
  3. 3Replace the script on a test page.
  4. 4Open the browser console and check that there are no errors.

Best-practice tips

  • Remove scripts you no longer use first, as that saves much more.
  • Keep your original code, as minified scripts are hard to debug.
  • Use the defer attribute so that scripts do not block the page.

Answers

JS Minifier FAQs

It is designed to remove only what cannot change the result, but always test a script before using it on a live site.

Related tools

Continue with these related website management tools.