⭐ Starlight Tools / JavaScript Minifier & Beautifier

JavaScript Minifier & Beautifier

Minify for compact size or beautify for readability — fully client-side for privacy.

Input: 0 B Output: 0 B Saving: —

About this tool

This JavaScript Minifier & Beautifier runs entirely in your browser—no uploads, no tracking, and no external APIs. The minifier uses a conservative tokenizer to safely remove comments and extra whitespace while preserving strings, regular-expression literals, and template literals (including nested ${...}). The beautifier applies indentation based on braces and statement boundaries for a readable result.

Options in brief

  • Remove comments – Strips // and /* ... */ comments.
  • Keep license – Preserves /*! ... */ banner comments (common for licenses).
  • Collapse whitespace – Removes unnecessary spaces/newlines (keeps what’s required for correctness).
  • Safe semicolons – Inserts semicolons in edge cases (e.g., between ) and [, or after return before a regex literal).

Keyboard shortcut: Ctrl/Cmd + Enter runs Minify. Your last input persists locally so you can pick up where you left off.

FAQ

Does any code I paste get uploaded?

No. This tool runs entirely in your browser. Nothing is sent to any server.

Is this as aggressive as production minifiers like Terser?

It’s intentionally conservative for safety and privacy. It removes comments/whitespace and preserves behavior, but does not perform advanced AST transforms or mangling.

Will it keep license headers?

Yes—enable “Keep /*! ... */ license banners” to preserve license comments.