Skip to main content

JavaScript Minifier

Minify your JavaScript code to reduce file size. Remove comments, whitespace, and unnecessary characters instantly.

Features

Everything you need to optimize your JavaScript for production.

Instant Minification

Remove comments, collapse whitespace, and strip unnecessary characters from your JavaScript in milliseconds.

Size Comparison

See original vs. minified file size and exact percentage savings at a glance.

String-Safe Parsing

Correctly handles comments inside strings and template literals. URLs with // are preserved, not stripped.

Size Comparison

See original vs minified size and exact byte savings percentage at a glance.

How It Works

Three simple steps to minify your JavaScript.

1

Paste Your JavaScript

Enter or paste your JavaScript code into the input area on the left.

2

Click Minify

Hit the Minify button to strip comments, whitespace, and unnecessary characters.

3

Copy the Result

The minified JavaScript appears on the right. Click Copy to save it to your clipboard.

Related Tools

More tools to help you optimize your web code.

Frequently Asked Questions

Common questions about JavaScript minification.

What does JavaScript minification do?

JavaScript minification removes all unnecessary characters from your code without changing its functionality. This includes comments (both single-line // and multi-line /* */), whitespace, newlines, and extra spaces around operators and braces. The result is smaller file sizes and faster page load times.

Will minification break my JavaScript?

This minifier performs safe transforms: removing comments and whitespace. It does not rename variables, inline functions, or perform tree-shaking. For most code it will work correctly. However, for production builds of complex applications, consider using full-featured bundlers like webpack or esbuild.

Does it handle URLs with // correctly?

Yes. The minifier uses a string-aware parser that distinguishes between single-line comments (//) and URLs containing :// (like https://). Comments inside strings and template literals are also preserved correctly.

Is my JavaScript code sent to a server?

No. Your JavaScript code is minified locally and never sent to any server. Safe to use with proprietary or sensitive code.