JS / JSON Minifier

Minify JavaScript and JSON to reduce file size for production, right in your browser.

JS / JSON Minifier Runs locally · No sign-up
Minified output

About JS / JSON Minifier

Before deploying a web page or a script, every extra byte costs download time, especially on slow connections. This minifier removes the whitespace, line breaks, and comments that are safe to drop, shrinking JavaScript and JSON files while leaving behavior untouched.

The tool works token-by-token rather than line-by-line, so it never removes a space that separates two identifiers or keywords, and it understands where comments end even inside strings and template literals. The output reports the exact size reduction, and for JSON it strips whitespace without ever changing a value.

Front-end developers minify inline scripts before shipping, and API consumers compress JSON payloads when every kilobyte counts. It is also a convenient sanity check before pasting code into a size-limited field, or when a snippet has to fit a tight budget.

How to Use

  1. Paste your JavaScript or JSON.
  2. Press Minify.
  3. Copy the compressed output and compare the size savings.

Example

function add(a, b) { return a + b; } function add(a,b){return a+b}

Whitespace and optional punctuation are removed where safe, shrinking the file without changing behavior.

FAQ

Is this as good as a full minifier like Terser?

It strips whitespace and comments safely for both JS and JSON, but doesn't rename variables. For full minification, combine with a build tool.

How much smaller will my file be?

Typical savings of 20-40% on readable code, shown as a percentage in the result.

Is the output safe to deploy?

Yes for JSON and for JavaScript that doesn't rely on line-based comments; your code should still be tested after minifying.

Does it remove console.log statements?

No. Only whitespace and comments are removed. Removing debug statements requires more advanced analysis, which is best left to build tools like Terser.

Is JSON handled differently from JavaScript?

JSON is validated before minification so its structure is verified, while JavaScript is only whitespace-reduced. Both modes report errors when the input is unparseable.