JavaScript Formatter
Basic JS beautify and minify in your browser; strings, templates and comments stay intact.
How to use it
- Paste JavaScript into the left panel - snippets, modules or bookmarklets all work.
- Pick the mode: Beautify re-indents with two spaces and breaks lines after braces and semicolons; Minify removes comments, indentation and blank lines.
- Click Convert, or keep typing - the result refreshes as you edit.
- Use Copy or Download to take the result with you.
Common use cases
- Reading minified code - add line breaks and indentation back to a compressed script before studying it.
- Pre-publish cleanup - strip development comments and blank lines from a snippet you are about to share.
- Normalizing pasted code - unify indentation across snippets collected from different sources.
- Debugging with devtools - a re-indented script sets friendlier breakpoints than one giant line.
Why it stays private
The whole pipeline is a small lexer running in your browser tab. Source code, credentials embedded in scripts and proprietary logic never leave your device.
FAQ
Q: Is this an AST-level formatter like Prettier? A: No, and the page says so up front. It re-lays-out code lexically: line breaks after braces and semicolons, two-space indentation, comment and string content preserved. It will not match Prettier on complex style rules.
Q: Can it break my code? A: Re-layout never changes tokens, so it is safe in the common case. The known limits: it does not detect regex literals, and minify keeps statement boundaries intact instead of joining lines, so ASI-sensitive code stays on separate lines.
Q: Why does minify keep the line breaks? A: Joining statements onto one line without a real parser risks changing automatic-semicolon-insertion behavior. Keeping line boundaries is the conservative choice for a lexical tool.
Your data stays on this device
JavaScript Formatter runs 100% locally. Everything you paste or drop is processed by your own browser and never transmitted. Nothing is stored on our servers — close the tab and it is gone.
Nothing you type is sent to a server, logged, or used for analytics. The page works even with your network disconnected after first load.