JavaScript Minifier

Conservatively compact JavaScript whitespace while retaining strings, comments, and line breaks. Runs entirely in your browser.

Why Minify JavaScript? — Reduce Bundle Size and Improve Time to Interactive

This tool performs conservative JavaScript whitespace compaction, not full parser-based minification. It collapses repeated spaces and tabs outside strings and comments while preserving line breaks.

What This Tool Preserves

JavaScript Bundle Size Impact on Performance

Transfer size, parsing, and execution can all affect performance. This compactor does not remove executable work, and a smaller source file does not guarantee a measurable speedup. Profile representative devices and network conditions.

JavaScript Optimization Best Practices

Frequently Asked Questions

This tool only compacts repeated spaces and tabs outside protected strings and comments. It retains line breaks and returns templates or ambiguous slash syntax unchanged. For stronger minification, use a parser-based tool such as esbuild or Terser.
Input processing is local to this tool. Shared page features may make network requests, and enabled browser drafts may retain text locally. Avoid pasting credentials or confidential material.
Strings and line breaks are protected, but this is not a full JavaScript parser or a universal equivalence guarantee. Source-sensitive code such as Function.toString() can observe whitespace changes. Test output before production use; templates and ambiguous slash syntax are left unchanged.
Savings depend on repeated spaces and tabs and may be small or zero. Comments and line breaks are retained; templates and ambiguous slash syntax return unchanged. Measure the result instead of expecting a fixed percentage.
Minification focuses on reducing file size by removing unnecessary characters while keeping code functionally identical. Obfuscation intentionally makes code harder to read by renaming variables, restructuring logic, and adding dead code. This tool performs minification, not obfuscation.