JavaScript Formatter
100% PrivateDeveloper ToolsBeautify compressed or messy JavaScript into consistently indented, readable code.
Runs entirely in your browser. Your input is not uploaded to Ovatly or anywhere else.
- 1Paste your JavaScript into the input box.
- 2Choose an indent size of 2 or 4 spaces.
- 3Press Format JavaScript.
- 4Copy or download the formatted code.
Worked example
Beautifying one-line code
Input: function add(a,b){return a+b;} Output: function add(a, b) { return a + b; }
- The formatter works on plain JavaScript. JSX components and TypeScript annotations are not supported.
- Formatting does not fix syntax errors; badly broken code may format strangely or be rejected.
- Semicolons and braces are laid out in a standard style; your logic is never changed.
It will format whatever you paste, but a large production bundle is better handled by your editor's formatter or a source map in devtools.
About this tool
The JavaScript Formatter beautifies compressed or messy JS into consistently indented code, one statement per line. It is what you use on a minified bundle snippet, a copied code sample, or a colleague's everything-on-one-line script before you try to read it.
Related tools
JavaScript MinifierMinify JavaScript in your browser by removing comments and unnecessary whitespaceDeveloper ToolsOpenCSS FormatterTurn compressed or messy CSS into readable code with one declaration per lineDeveloper ToolsOpenHTML FormatterBeautify messy HTML into clean, indented code, or minify it back down for productionDeveloper ToolsOpenJSON Formatter and ValidatorFormat JSON with your choice of indentation, validate it and explore its structureData & JSON ToolsOpen
Advertisement
Part of Ovatly's free tools in Developer Tools.