About the JavaScript Minifier Tool
The JavaScript Minifier Tool reduces the size of your JavaScript code by removing comments and collapsing unnecessary whitespace — a quick way to compact a small snippet without pulling in a build tool.
This is a lightweight, text-based minifier rather than a full JavaScript parser like Terser or esbuild — it doesn't rename variables or perform advanced optimizations, so it's best suited for quickly compacting a snippet rather than minifying a full production bundle.
How to Use This Tool
Paste your JavaScript
Enter or paste the JavaScript code you want to minify.
Click "Minify Code"
Comments and extra whitespace are instantly stripped from your code.
Copy the result
Use the "Copy Minified Code" button to save the output.
Common Use Cases
Quickly Shrinking a Small Script: Trim comments and whitespace from a short script before pasting it somewhere space-constrained.
Removing Comments Before Sharing Code: Strip internal comments out of a snippet before sharing it externally.
Previewing What Basic Minification Looks Like: See how whitespace and comment removal affects readability as a learning exercise.
Cleaning Up Copy-Pasted Snippets: Quickly compact a code snippet copied from documentation or a tutorial.
Why Use This Tool
Instant Processing
Strips comments and collapses whitespace in a single click.
No Setup Required
Works directly in your browser — no build tools or dependencies needed.
One-Click Copy
Copy the minified result instantly for use elsewhere.
