JavaScript Formatter
Make minified or inconsistently formatted JavaScript readable again, with the style options your team uses.
Your data stays on your device
Input — JavaScript
- characters
- 0
- lines
- 0
- size
- 0 B
Output — Formatted JavaScript
- characters
- 0
- lines
- 0
- size
- 0 B
Options
About this tool
Reading a bundled or minified script is difficult by design — variable names are shortened and all the whitespace is gone. Formatting restores structure, which is often enough to understand what a third-party snippet is doing.
It is equally useful for tidying code pasted from an article or a chat, where indentation has been destroyed. Modern syntax including classes, async functions, optional chaining and ES module declarations is handled.
How to use this tool
- Paste JavaScript or upload a .js file.
- Set indentation, brace style and whether to preserve blank lines.
- Press Format.
- Copy the formatted code or download it.
Key features
- Configurable indent width and space or tab indentation
- Brace style options including collapse and expand
- Modern syntax support: classes, async/await, optional chaining, modules
- Configurable maximum preserved blank lines
- Optional semicolon insertion
- Comments preserved in place
Example
Input — JavaScript
const f=(a,b)=>{if(a>b){return a}return b}Output — JavaScript
const f = (a, b) => {
if (a > b) {
return a
}
return b
}Good to know
- Minified code cannot be truly unminified. Original variable names are gone forever and formatting only restores structure.
- Source maps are not consumed, so no original naming is recovered.
- TypeScript-specific syntax such as type annotations is not supported on this page.
Frequently asked questions
Can it recover the original source?
No. Minification is lossy for identifiers. You get readable structure with the short names intact.
Does it work on JSX?
Basic JSX is handled, but a dedicated tool such as Prettier in your project will produce better results for React code.
Is my code executed?
Never. It is parsed as text and re-printed. Nothing is evaluated, which is important when inspecting an unknown script.
What about TypeScript?
Not supported here. Type annotations would be misparsed. Use your project formatter for .ts files.
Your data stays on your device
Your data is processed locally in your browser and is not uploaded to our server. This page keeps working after you go offline, because there is nothing to send.