JS

Minify JS

Safely shrink JavaScript by stripping comments and whitespace - never joins lines.

js-minifier.tool
0 chars
Result will appear here
Nothing you paste here is ever sent to a server - processing happens locally in your browser.
Overview

What is a minify js?

This tool shrinks JavaScript by stripping comments and unnecessary whitespace - safely. Unlike aggressive minifiers that join lines together, this one deliberately never merges two lines, because JavaScript's Automatic Semicolon Insertion (ASI) means joining lines without a full parser can silently change what your code does (a bare `return` followed by a newline behaves completely differently from `return` followed directly by a value on the same line).

Quick start

How to use this tool

  1. 1Paste your JavaScript, or upload a .js file.
  2. 2Click Run - comments are stripped and blank/indented whitespace is removed.
  3. 3The size reduction percentage is shown next to the output.
  4. 4Copy the result or download it as a .js file.
Where it helps

Common use cases

Quickly shrinking a script for a size-conscious embed or snippet
Cleaning comments and formatting out of code before sharing it
Reducing a script's size when a full build pipeline (webpack, esbuild) isn't available
Preparing JavaScript for a context with tight character limits
Good to know

Frequently asked questions

Why doesn't this achieve the tiny output size that Terser or UglifyJS produce?

Those tools use a full JavaScript parser to safely rewrite code - renaming variables, joining statements, removing dead code. Building that from scratch isn't realistic for a browser-based utility, and a naive line-joining approach can silently break code due to Automatic Semicolon Insertion. This tool trades maximum compression for a guarantee that your code's behavior never changes.

Are comments inside strings affected?

No - the tool tracks string and template literals character by character, so something like a URL containing // inside a string is never mistaken for a comment.

For production deployments, what should I use instead?

A bundler-integrated minifier like Terser (used by webpack) or esbuild, which parses your code into an AST and can safely make far more aggressive size reductions than a text-based tool like this one.

Is my code sent anywhere?

No - everything runs locally in your browser.

quick_facts.json

{

"runs_in_browser": true,

"data_sent_to_server": false,

"signup_required": false,

"price": "free",

"category": "Converters"

}

Related tools

#FF
No signup
Color Converter

Convert colors between HEX, RGB, HSL, and CMYK — online color converter with live preview.

Open tool
No signup
Timestamp Converter

Convert Unix timestamps to and from human-readable dates.

Open tool
JSON
No signup
CSV to JSON

Convert CSV files into structured JSON, with optional type inference.

Open tool