Minifies or beautifies JavaScript for faster page loads.
This minifier only strips comments and extra whitespace. It never renames variables or restructures code, since doing that safely needs a real parser.
Input
function greet(name) { // say hello return `Hi ${name}`; }
Output
function greet(name) { return `Hi ${name}`; }
Minifying JavaScript safely is harder than it looks at first glance. A real minifier like Terser or esbuild parses code into an actual syntax tree before it renames variables shortens functions and removes dead branches. Building something like that from scratch isn't realistic for a browser-only tool with no dependencies so this one takes a narrower and much safer approach instead.
What it does well is strip out comments both the single-line kind and the block kind while scanning carefully enough to recognize when it's actually looking at a string a template literal or a regular expression rather than real code. That distinction matters because any of those three can contain text that looks exactly like a comment starting. A URL inside a string literal often contains a double slash and a regex can too and naively stripping everything after a double slash would quietly corrupt code like that. This tool tracks which kind of literal it's currently inside and leaves the content alone until that literal closes.
Beyond comments, minify mode trims each line and collapses runs of spaces and tabs down to one. That's it. No variable renaming, no dead code removal, no restructuring of control flow. That trade-off is deliberate: a minifier that occasionally mangles working code is worse than one that saves fewer bytes but never breaks anything. For real production minification on a sizeable codebase a proper build-tool minifier is still the right choice. This one is meant for quick one-off cleanup, not a build pipeline.
Beautify mode is intentionally modest too. It un-does the same comment stripping, then re-indents based on brace, bracket, and paren depth, nudging lines that start with a closing character back one level. It won't reformat a deeply nested one-liner into textbook style the way a tool built around a real parser would, but it does make a wall of minified code readable enough to understand what's happening.
Nothing you paste here is sent to a server. Comment stripping, whitespace collapsing, and the rough re-indentation all run locally in your browser, which makes this fine for proprietary code you'd rather not upload anywhere.
More Developer Tools