JavaScript Minifier — Free
Remove comments and collapse whitespace from JavaScript. Updates in real time. 100% private — for full AST minification use a build tool like esbuild.
What gets removed
Block comments (/* … */), line comments (//), extra spaces and newlines. String contents are preserved exactly.
Basic minification
This is whitespace/comment removal, not AST-based. For variable renaming and tree-shaking use esbuild or terser.
Fully private
All processing runs in your browser. Your JavaScript code never leaves your device.
What is a JavaScript minifier?
A JavaScript minifier removes everything from your code that isn't needed for it to run — comments, extra whitespace, and unnecessary line breaks — producing a smaller file that executes identically but downloads and parses faster. Pixvert's JavaScript minifier processes your code instantly and shows the exact byte reduction achieved.
JavaScript written for development is formatted for readability: indentation, spacing, descriptive comments explaining logic. None of that affects how the code runs, so stripping it before deployment reduces file size, which matters directly for page load speed, especially on slower mobile connections.
Minifying JavaScript is a core part of most production build pipelines (Webpack, Vite, esbuild all do this automatically), but this tool is useful for quickly minifying a single script, a snippet, or a small project that doesn't use a bundler.
How to minify JavaScript
- 1
Paste your JavaScript — drop in your code, formatted however it currently is
- 2
Minify instantly — comments and unnecessary whitespace are stripped automatically
- 3
Check the byte reduction — see exactly how much smaller the minified version is
- 4
Copy the result — copy the minified code with one click and use it in production
When to use a JavaScript minifier
Preparing scripts for production
Reduce file size before deploying a script to a live website, speeding up page load.
Standalone scripts without a build tool
Minify a script for a simple project that doesn't use Webpack, Vite, or a bundler.
Embedding scripts inline
Minify JavaScript being embedded directly in an HTML `<script>` tag to keep the page lean.
Checking savings before adopting a build process
See exactly how much a specific script would shrink before setting up a full minification pipeline.
Why use Pixvert's JavaScript minifier?
- ✓Instant byte reduction stats: see exactly how much smaller your script becomes
- ✓100% local and private: your code is processed entirely in your browser
- ✓No build tool required: minify a script without setting up a bundler
- ✓Free, instant, no signup: minify as many scripts as you need
Frequently Asked Questions
Does minifying JavaScript change how it runs?
No, minification only removes comments and formatting that don't affect execution — the functional behavior of your code stays identical.
Is my code sent to a server?
No, all minification happens locally in your browser using JavaScript. Your code is never transmitted or stored.
How much smaller will my script get?
It depends on how many comments and how much whitespace the original has, but a 20-50% reduction is common for typically formatted development code.
Does this minifier rename variables like advanced tools do?
No, this tool focuses on removing comments and whitespace. Advanced minifiers used in build tools also shorten variable names, which can yield further size reduction but requires more careful handling of scope.
Will minifying break my code if it has syntax errors?
The minifier expects valid JavaScript input. If your code has a syntax error, fix it first, since minifiers generally can't process broken syntax reliably.
Is there a file size limit?
No hard limit is enforced, though extremely large scripts may take a moment to process depending on your device.