All tools

JavaScript Minifier

Shrink JavaScript safely by removing comments and whitespace.

JavaScript Input
Minified JavaScript

Minify JavaScript Safely

This minifier takes a conservative, safe approach: it removes comments, indentation, and blank lines, and collapses extra spaces, while preserving line breaks so automatic semicolon insertion (ASI) can never change your code's behaviour. Strings, template literals, and regular expressions are left untouched.

What it removes

  • Single-line and block comments
  • Indentation and blank lines
  • Redundant spaces between tokens

What it never breaks

By keeping newlines, the minifier avoids the classic ASI pitfall where joining lines silently changes a return statement. Quoted strings, template literals, and regex literals are preserved exactly as written.

Conservative by design

A full optimiser like Terser renames variables and rewrites expressions, which yields smaller output but requires a complete parser. This tool prioritises correctness for quick, safe minification — ideal for snippets, inline scripts, and situations where you must be certain behaviour is unchanged.

100% Private & Processed Locally

Every conversion on this page runs entirely inside your browser using JavaScript. Your data is never uploaded to a server, logged, or stored — making this tool safe even for sensitive payloads such as API responses, configuration files, and access tokens.

Because there is no network round-trip, conversions are instant and work even when you are offline. It is free to use with no sign-up, no rate limits, and no ads injected into your output.

Frequently Asked Questions

Common questions about the JavaScript Minifier.

How does it minify safely?
It removes comments, indentation, and blank lines and collapses extra spaces, but preserves line breaks so automatic semicolon insertion can never change behaviour.
Are strings and regex preserved?
Yes. The contents of strings, template literals, and regular expressions are left exactly as written.
Is my code private?
Yes. Minification runs locally in your browser and your code is never uploaded.

More Developer Utilities

View all tools →
JSON ValidatorJSON MinifierJSON to CSVCSV to JSONJSON to XMLXML to JSONJSON to YAMLYAML to JSON
File Transfer