Formatters
JavaScript Formatter
Bundled scripts, snippets from forums and code pasted from chat apps rarely keep their indentation. The JavaScript Formatter re-flows your code with consistent indentation, line breaks after statements and readable spacing around operators.
It is a quick way to understand an unfamiliar function or to tidy a snippet before sharing it — without installing an editor plugin.
How to use the JavaScript Formatter
- 1Use the JavaScript Formatter right on this page, or open the full workspace for history, sharing and every other tool.
- 2Paste your input, upload a file, or drag and drop a file onto the input box (up to 25 MB).
- 3The result appears in the output panel automatically and updates when you change the input or an option.
- 4Use Copy Output or Download to save the result. Nothing is uploaded to a server.
Example
A compressed function is expanded with each statement on its own indented line.
Input
function hi(name){return "Hello "+name;}console.log(hi("Ada"));Output
function hi(name) {
return "Hello " + name;
}
console.log(hi("Ada"));When to use it
- Reading a minified script to understand what a page is doing
- Tidying a snippet before pasting it into documentation or a pull request
- Normalising code style while learning JavaScript
Tips and common mistakes
- The formatter does not rename variables, so minified names like a and b stay as they are.
- Syntax errors may produce odd indentation — check brackets and quotes first.
- Use the JavaScript Minifier for a compact copy once you are done editing.
Frequently asked questions
Does it run my code?
No. The code is only re-formatted as text; it is never executed.
Does it support modern syntax?
Common modern syntax such as arrow functions, template strings and async/await is handled.
Related tools
Ready to try it?
Free, no sign-up, and your data never leaves your browser.