JavaScript Beautifier & Minifier
Strips comments and whitespace from JavaScript or TypeScript without renaming anything, and re-indents a minified bundle so it can be read again.
Beautifies minified JavaScript or TypeScript so you can read it, and strips comments and whitespace when you want it smaller. It is built on a tokeniser rather than a parser, and that boundary is the honest thing about it: nothing is renamed, no expression is rewritten, and nothing inside a string, template or regex is touched.
JavaScript · TypeScript in
Drop a .js or .ts file
Read in this tab only. Nothing is uploaded.
Formatted
Tokens
109
Lines
18
Honestly: this is a tokeniser, not a parser
- · The tokeniser is exact about regex literals versus division, about
${ {a:1}.a }inside a template literal, and about a // inside a string. So nothing inside a string, a template or a regex is touched. - · Minify removes comments and whitespace only. It renames nothing and rewrites no expression, and it keeps the line breaks that automatic semicolon insertion depends on — after
return, before a postfix ++, and where the next line starts with ( or [. It will not get as small as Terser, and it will not change behaviour either. - · Format finds statement boundaries from brace and bracket depth and from ;, re-indents, and leaves the line breaks that were already there. It does not insert semicolons, does not wrap long lines, and cannot tell an object literal from a block, so both get one entry per line.
- · TypeScript generics like
Map<string, T>and a comparison likea < bare told apart by looking at the surrounding tokens. JSX is not handled. - · Enough to make an obfuscated bundle readable; Prettier is the right tool for code you are about to commit.
To find the original position behind a minified stack trace, use Source map un-minify.
How to use it
Paste the code or drop a file
A one-line bundle, a file with mixed indentation, TypeScript with generics — all read the same way. The file is read in this tab.
Choose Format or Minify
Format re-indents by brace depth and leaves your existing line breaks alone. Minify removes comments and whitespace and nothing else, keeping the `/*!` licence headers if you ask.
Watch the token stream check
The significant tokens of the output are compared to the input on every run. If they ever differ the page says so in red and tells you to use your input instead — the one failure mode that must never be silent.
Common questions
Why is my minified file still bigger than Terser’s?
Because this only deletes comments and whitespace. Terser parses the program and can rename local variables, fold constants and drop dead branches; that requires an AST and a scope analysis, and getting either subtly wrong changes behaviour. The trade here is a smaller saving that cannot break your code.
Will minifying break automatic semicolon insertion?
No — the line breaks ASI depends on are kept: after a `return`, before a postfix `++`, and where the next line starts with `(` or `[`. Those are precisely the places where removing a newline changes what the program does.
Why does my object literal come out one property per line?
Because a tokeniser cannot tell an object literal from a block — both are `{`. Everything at brace depth gets the same treatment. A parser would know the difference; this deliberately is not one.
Does it handle JSX?
No. JSX needs the parser this does not have — `<Foo>` is indistinguishable from a comparison at the token level, and the generics heuristic that copes with `Map<string, T>` is already the edge of what guessing can do. Use Prettier for a `.tsx` file.
Can I use this instead of Prettier?
For reading an obfuscated bundle, yes — that is what it is for. For code you are about to commit, no: it does not insert semicolons, does not wrap long lines and has no opinion about argument lists. Prettier reprints from an AST, which is why it can.
Feed it from
HTML Beautifier & Minifier
Formats or minifies HTML, preserving inline elements and optionally collapsing whitespace.
CSS Beautifier & Minifier
Formats or minifies CSS without reordering anything, preserving the token stream exactly.
Source Map Resolver
Maps a minified stack trace back to original files and lines using a source map you supply.
WebAssembly Inspector
Lists imports, exports, memory and section sizes of a .wasm module and prints its text format.
Next
These accept what this tool produces, so the result can go straight in.
Code Screenshot
Renders a code snippet as an image with syntax highlighting, a window frame and a chosen theme.
CSS Beautifier & Minifier
Formats or minifies CSS without reordering anything, preserving the token stream exactly.
HTML Beautifier & Minifier
Formats or minifies HTML, preserving inline elements and optionally collapsing whitespace.
Source Map Resolver
Maps a minified stack trace back to original files and lines using a source map you supply.
Base64 Encoder & Decoder
Encodes and decodes Base64 and Base64URL for text or files, handling UTF-8 correctly.
curl to Code
Converts a curl command into fetch, axios, Python requests, Go, PHP or PowerShell.