Skip to content

JavaScript Minifier

Minify JavaScript by removing comments and unnecessary whitespace to reduce file size.

JavaScript MinifierGratisCSS & DevRuns in your browser

Works in your browser. What you paste or upload is processed on your device.

Key features of the JavaScript minifier

  • Removes // and /* */ comments
  • Collapses line breaks, indentation and extra spaces
  • Strips spaces around operators and punctuation
  • Shows original size, minified size and percentage saved
  • One-click copy; runs in your browser

How to use the JavaScript minifier

  1. Paste your JavaScript

    Paste the code into the input box.

  2. Read the output

    The minified code appears as you type, with the size saving.

  3. Test it

    Run the minified code in your page or console to confirm it still works.

  4. Copy and use

    Copy the result into your page, tag manager or file.

What is a JavaScript minifier?

A JavaScript minifier makes JS code smaller by removing what the engine doesn't need: comments, line breaks, indentation and spaces around operators. Paste your code and this tool returns the minified version as you type, with the original and minified character counts and the percentage saved. It runs in your browser.

It is a whitespace-and-comment minifier. It does not rename variables, remove dead code or rewrite expressions the way Terser or esbuild do, so the saving is smaller than a full build tool's, but the output stays readable enough to debug.

Limits: the tool uses text rules, not a JavaScript parser. Anything that looks like a comment is removed even inside a string, such as the // in "https://example.com", and code that relies on line breaks instead of semicolons can break once lines are joined. Test the output before you deploy it, and use Terser or esbuild in your build for production bundles.

Why use a JavaScript minifier?

Smaller JavaScript downloads and parses sooner, which helps load time. A quick online minifier is handy for a one-off snippet, an inline script, a bookmarklet or a tag manager script where a full build pipeline is overkill.

JavaScript minifier: frequently asked questions

Something else? Ask the team

What does minifying JavaScript do?

It removes characters the JavaScript engine doesn't need, such as comments, whitespace and line breaks, so the file is smaller. Advanced minifiers also shorten variable names and remove unused code. The program behaves the same; only its size and readability change.

Does minified JavaScript run faster?

It downloads and parses faster because there are fewer bytes, but run-time speed doesn't change. Combine minification with gzip or Brotli compression on the server for the biggest saving.

Does this minifier rename variables?

No. It removes comments and whitespace only. For variable renaming (mangling) and dead-code removal, use Terser, esbuild or SWC, which most build tools include.

Why did my minified code break?

The usual causes are a // inside a string or URL being treated as a comment, a regular expression containing //, or code without semicolons that depended on line breaks. Add semicolons, or minify with a parser-based tool such as Terser.

What is the difference between minify and uglify?

Minify means making code smaller. UglifyJS was a popular minifier, so "uglify" came to mean minifying with variable renaming. Today Terser, which grew out of UglifyJS, is the common choice.

Can I un-minify JavaScript?

You can restore the formatting with the JavaScript beautifier, but removed comments and original variable names can't be recovered without a source map.

Meer AI-vermeldingen winnen?

JavaScript Minifier is one piece of the puzzle. See how ChatGPT, Gemini, Perplexity, and Google AI Overviews actually view your brand, and get a prioritised list of fixes, with a free AEO & GEO audit from AI Rank Lab.

One check is a start. The audit checks the whole site.

Voer een gratis AEO- en GEO-audit uit or Bekijk prijzen.

  • Scores SEO, answer-engine (AEO) and generative-engine (GEO) readiness
  • Lists the fixes, page by page
  • Then track whether ChatGPT, Gemini, Perplexity and Google AI Overviews cite you
fieldnote.app4,571 credits

Site audit

fieldnote.app · SEO, AEO and GEO

Illustrative data
SEO
82
+6
AEO
64
+11
GEO
58
+9
Pages
48
Fixesby impact
  • /pricing · Missing H1High
  • /blog/guide · No FAQ schemaMedium
  • /llms.txt · Not foundMedium
  • /about · Meta description too longLow

See where your whole site stands

Paste your site. The free audit scores it for SEO, answer engines and generative engines, with the fixes.