0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
Configuration
Format and beautify JavaScript and TypeScript code with configurable indentation, line width, and quote style options. Adjust the options, paste the code into the editor, and press Format. The result can be copied to the clipboard with one click.
Source code
Lines:0Characters:0

How it works

Reindents and tidies minified, compressed, or misaligned JavaScript or TypeScript code to make it readable and consistent. Useful for inspecting a bundle, reviewing someone else's snippet, or normalizing the style before pasting it into your project.

You can choose the indentation type (spaces or tabs), the indent size, and the line ending (LF or CRLF). The formatter respects the code structure and adds consistent line breaks and indentation without changing the logic.

All processing happens in your browser with js-beautify: the code is not uploaded to any server. It formats only the visual appearance; it does not minify, transpile, or deeply validate the syntax.

Examples

function sum(a,b){return a+b} const r=sum(1,2);console.log(r)function sum(a, b) { return a + b } const r = sum(1, 2); console.log(r);With 4-space indentation: statements are separated and braces are aligned.

Use cases

  • Make a minified .js file readable to understand what it does.
  • Unify the indentation style of a snippet before adding it to the project.
  • Review and compare third-party code with a consistent format.
  • Clean up TypeScript pasted from documentation or AI responses.

Frequently asked questions

Does it work with TypeScript as well as JavaScript?

Yes. The tool formats JavaScript and TypeScript syntax, including type annotations, interfaces, and generics. It does not transpile TypeScript to JavaScript: it only rearranges the text.

Does formatting change the code's behavior?

No. It only modifies spaces, indentation, and line breaks. The logic and identifiers remain intact; the code runs exactly the same as before.

Is it the same as minifying?

No, it is the opposite. Formatting adds spaces and line breaks to make it readable; minifying removes them to reduce the size. If you want to compress, use the minification tool.

Is my code uploaded to a server?

No. Formatting happens entirely in your browser; the code never leaves your computer.