JavaScript Formatter
Format and beautify JavaScript code, with configurable indent and brace style.
Processed locally in your browser. Nothing you enter is uploaded or stored.
- Re-indents and spaces code without touching strings, template literals or comments.
- Matches your project's actual style — indent size (2/4 spaces or tabs) and brace placement (same line or own line), not one fixed default.
- Fast way to make minified or messy code reviewable.
- Runs in your browser; code isn't uploaded.
Why this is private
- Processed locally in your browser. Nothing you enter is uploaded or stored.
- Open your browser's DevTools → Network tab while using this tool — you won't see a request carrying your input, because it never leaves your device.
- Nothing you enter is uploaded to a server or shared with us — the processing happens entirely on your device.
Overview
Re-indents and cleans up JavaScript so it's consistent and easy to read — useful for minified code or code pasted from inconsistent sources. Choose 2 spaces, 4 spaces or tabs, and whether braces sit on the same line or their own.
How to use it
- 1Paste JavaScript code.
- 2Pick an indent size and brace style to match your project's convention.
- 3The formatted output updates automatically.
Tips
- This re-indents and spaces code consistently; it doesn't rewrite logic or enforce a style guide the way a linter would.
Frequently asked questions
What people use it for
Read a minified bundle or snippetExpand production JS enough to trace what a function does.
Tidy code pasted from a chat or article to match your project's styleFix inconsistent indentation and brace placement before dropping it into a codebase with its own conventions.
Normalise a quick scriptFormat a one-off Node script so it's maintainable.
Prepare code for a screenshot or docsConsistent formatting reads better in a tutorial.
Related guides
- How to read JSON with a tree viewerA tree viewer turns a wall of brackets into a structure you can expand, search and copy paths from. Here's how to use one effectively.
- JSON parse errors explained: 'Unexpected token', 'Expected comma or brace', and the restWhat each common JSON error message actually means, the usual cause, and how to find the spot fast using line and column.
- How to format JSON (and actually understand the errors)JSON looks like a JavaScript object but follows stricter rules. Here's what those rules are and how to read the errors when they're broken.
Related tools
All developer toolsJavaScript MinifierCompress JavaScript with real minification, not just whitespace removal.JSON Viewer & FormatterView, format, validate, edit and beautify JSON with an interactive tree view, plus a shareable link.HTML FormatterFormat and indent HTML markup for readability.CSS FormatterFormat and beautify CSS stylesheets.
Ready to use JavaScript Formatter?
JavaScript Formatter