JavaScript Formatter
Format and beautify JavaScript code with sensible defaults. Everything runs in your browser, so your source never leaves the page.
About this JavaScript formatter
This is a free online JavaScript formatter and beautifier. Paste a minified bundle, a messy snippet, or any JavaScript source into the input panel and you'll get a tidy, indented version in the output panel. Statements, blocks, and expressions are laid out on their own lines so the code is easy to read and review.
Features
- Format JavaScript with 2 spaces, 4 spaces, or tab indentation.
- Wrap long lines at 80, 100, or 120 columns.
- Preserve existing identifiers, values, and string literals exactly.
- Copy the result or download it as a
.jsfile.
How it works
The tool uses the JavaScript beautifier from the open source js-beautify library, loaded into your browser on first use. It tokenizes the source, normalizes whitespace and line breaks, and writes the result back with your chosen indentation.
Privacy
Your code never leaves your browser. The whole tool runs locally as JavaScript on this page, so you can safely paste proprietary application code, third-party bundles, or anything else without it touching a server.
Frequently asked questions
Does this tool send my code anywhere?
js-beautify library is fetched once from a public CDN, but your code is never uploaded.