Skip to content
My Tiny Utils

Search tools

Type to find a tool, then press Enter to open it.

JavaScript Minifier

Remove comments and insignificant whitespace from JavaScript with a tokenizer that respects strings, template literals, and regex.

Processed locally in your browser — nothing is uploaded.

0 characters

Whitespace-level only: comments and insignificant spacing are removed, but nothing is renamed or rewritten, and line breaks that automatic semicolon insertion depends on are kept.

Minified JavaScript

Output appears here…

About JavaScript Minifier

A safety-first whitespace minifier. A real tokenizer walks the source, so strings, template literals (including nested ${} expressions), regular expression literals, and comments are each recognised for what they are and never corrupted.

Line breaks that automatic semicolon insertion depends on are preserved — a newline is only dropped where it provably cannot change how the code parses. That costs a few bytes compared with an aggressive compressor and buys you output you can paste without re-testing.

Common uses

  • Strip comments from a snippet before pasting it into a bookmarklet or inline script
  • Shrink a small standalone script on a site with no bundler
  • See a dependency-free file with its documentation removed

Example

Input

// greet
function hi(name) {
  return `Hello, ${name}`;
}

Output

function hi(name){return `Hello, ${name}`;}

Limitations

  • Whitespace-level only — this is not a compressor: no variable renaming, dead-code removal, or expression rewriting
  • Savings are far smaller than a real minifier's; use a build-step tool for production bundles