JSON Formatter
JSON Formatter for developers — instant, offline-style and privacy-safe.
Minify JavaScript — strip comments and collapse whitespace to shrink a script — right in your browser. A naive regex minifier: fast, but it can break real code.
Your browser is preparing the tool. It runs 100% locally.
Paste JavaScript and the tool removes comments and the whitespace around operators and punctuation, collapsing the script toward one line. Be warned: it is a naive regex minifier, not a real one. It does not understand strings, template literals or regular expressions, so it can break working code in those cases. Use it for trivial snippets and reach for a proper minifier like Terser for anything real. It runs in your browser; nothing is uploaded.
This tool makes a quick attempt at shrinking JavaScript by deleting comments and squeezing out the whitespace that the engine does not need — the indentation, and the spaces around operators and punctuation. For simple, self-contained snippets the output is smaller code that still runs.
It is a fast, no-build way to compress a small script. But because it works by pattern-matching rather than understanding the language, it comes with real caveats — it is best thought of as a rough whitespace squeezer, not a production minifier.
The tool runs a sequence of regular expressions: it removes block comments and line comments, strips the indentation at the start of each line, removes the whitespace on either side of operators and punctuation, and finally joins the lines together. There is a small guard so that the slashes in a URL like a https address are not mistaken for a comment.
Crucially, it never parses the code. It does not know where a string starts or ends, what is inside a template literal, or where a regular expression sits. It just reacts to characters. That is why it is fast and dependency-free — and also why it can corrupt code that a real, parser-based minifier would handle safely.
• remove block and line comments (with a guard for a URL)
• strip leading indentation
• remove whitespace around operators and punctuation
• join the lines into one
it never parses — it cannot see strings, templates or regexBefore: function add(a, b) { return a + b; }
After: function add(a,b){return a+b;}That simple case works. But a line comment marker inside a string gets treated as a comment and truncates the string; a multi-line template literal has its indentation collapsed, changing the text; and removing spaces around the divide sign can corrupt a regular expression. A parser-based minifier avoids all of these.
Your code never leaves your device. It is minified in your browser with no network request, so nothing is uploaded.
Because the work is local, you can run it on proprietary scripts without them being stored or sent anywhere — though for real code you should use a proper minifier.
Nothing persists between sessions — close the tab and the input and output are gone.
For a small, self-contained function the output is correct and smaller. But this is a naive regex minifier, and on real code it can break things — it is best used only for trivial snippets you can eyeball afterwards.
It does not understand strings. A line-comment marker inside a string is treated as the start of a comment, so the rest of that line — including the closing quote — is deleted, corrupting the code. A parser knows the marker is inside a string and leaves it alone.
Template literals and regular expressions are at risk too. The indentation inside a multi-line template literal is collapsed, changing the text it produces, and removing the spaces around the divide sign can mangle a regular expression. The tool cannot tell these apart from ordinary code.
It does not rename variables or do any real optimisation, so even when it works it compresses less than a proper minifier. And by joining lines it can run into automatic-semicolon-insertion issues. For anything beyond a trivial snippet, use Terser or esbuild.
Compress a few lines of simple JavaScript you can check by eye.
See roughly how much whitespace a small script carries.
Watch comments and spacing disappear from simple code.
Shrink a small, string-free function for a quick paste.
For anything real, use a parser-based minifier — Terser or esbuild — which preserves strings, template literals and regex, handles semicolons safely, and can rename variables for far better compression. This tool is only for trivial snippets you will verify by hand.
Shrinks by stripping comments and removing whitespace around operators with regular expressions; honest that this naive approach can corrupt strings, template literals and regex patterns, so it is for trivial snippets only.
JSON Formatter for developers — instant, offline-style and privacy-safe.
JSON Validator for developers — instant, offline-style and privacy-safe.
Base64 Encoder for developers — instant, offline-style and privacy-safe.
Fast, free Hash Generator that runs entirely client-side in your browser.
Fast, free UUID Generator that runs entirely client-side in your browser.
Fast, free CSS Minifier that runs entirely client-side in your browser.
It is free, private and runs entirely in your browser — no sign-up, no uploads, no limits.