JS Formatter/Minifier
Paste your script below and this js minifier either formats it for readability or compresses it down for production, in one click either way.
About
About JS Formatter/Minifier
A js minifier strips a JavaScript file down to the smallest version that still runs exactly the same, removing whitespace, comments, and unnecessary characters while leaving the actual logic untouched. The formatting side of this js formatter minifier does the reverse, restructuring compressed or inconsistently written code back into something readable enough to debug.
A real minifier doesn't just delete whitespace, it also shortens local variable and function names where it's safe to do so without changing behavior, since a function-scoped variable can be renamed freely as long as every reference inside that scope is renamed to match. This is different from obfuscation, which renames things specifically to make the code harder to understand, not just smaller.
JavaScript's automatic semicolon insertion, the rule that lets you omit semicolons in many cases, is exactly the kind of detail that makes writing a correct minifier harder than it looks. Removing a line break in the wrong place can silently change how two statements get parsed, which is why a dependable minifier works off the actual parsed syntax tree rather than just stripping characters with pattern matching.
Paste your script and choose format if you're trying to read through logic or hunt down a bug, or minify once you're ready to ship it. The minified output keeps your functions and variables working exactly as before, just represented with far fewer characters.
Nothing you paste here gets sent to a server at any point, since both the formatting and compression logic run inside your browser. That matters if the script contains API endpoints, internal business logic, or anything else you'd rather keep off a third-party server.
FAQ
Frequently asked questions
Why does minifying JavaScript matter for a live website?
It reduces the file size the browser has to download and parse before your page becomes interactive, which directly improves load time, especially on a slower mobile connection.
Will minifying ever change how my code actually behaves?
It shouldn't, a correct minifier only removes characters and safely renames scoped variables, never altering your program's logic. If behavior changes after minifying, that usually points to code that was relying on something fragile, like a specific line break position, beforehand.
Can I reverse a minified file back into something readable?
You can format it back into readable code with proper spacing and indentation, but the original variable and function names are gone for good unless you kept the original source or a source map.
Does this catch actual bugs or syntax errors in my JavaScript?
No, it's built for formatting and compression, not for linting. A dedicated linter like ESLint is the right tool if you need to catch logic errors or bad patterns in your code.
Is my source code uploaded anywhere during formatting or minification?
No, both processes run entirely in your browser. Your functions, API calls, and business logic never leave your device.
What's the actual difference between minification and obfuscation?
Minification shrinks file size while keeping the code's structure essentially the same. Obfuscation deliberately renames things and restructures logic to make the code difficult for a human to read and reverse-engineer, which is a different goal entirely from just reducing size.
Related tools
View all developer tools →Markdown to HTML Converter
Convert Markdown into clean HTML you can paste straight into your page.
Open toolHTML to Markdown Converter
Convert HTML into clean Markdown for docs, notes or blog posts.
Open toolMarkdown Editor & Previewer
Write Markdown on one side and watch the rendered preview update on the other.
Open toolHTML Formatter/Beautifier
Clean up messy, minified or badly indented HTML in one click.
Open tool