JavaScript & TypeScript Formatter & Beautifier

Format and beautify JavaScript or TypeScript online using Prettier. Fix indentation, enforce consistent semicolons and quotes, and minify JavaScript for production with Terser.

Language: Semicolons: Quotes: Indent:
Copied
Input0 B
Output0 B

Why format JavaScript or TypeScript?

Consistent formatting removes an entire category of code review comments and diff noise, and makes code from different authors (or an older part of the codebase written before a style was adopted) read like it belongs together. This tool runs the real Prettier engine in your browser, so the output matches what your team's editor or CI would produce.

Beautify vs. minify

Example

BeforeBeautified
function add(a,b){return a+b}function add(a, b) {
  return a + b;
}

Frequently asked questions

How do I format JavaScript online?

Paste your JavaScript or TypeScript into the input box and click Beautify. The formatter runs Prettier instantly to fix indentation, quotes, and semicolons.

How do I beautify TypeScript?

Beautifying TypeScript reformats types, interfaces, and code using Prettier's TypeScript parser. Click Beautify with TypeScript selected, and the beautifier handles the syntax automatically.

Why can't I minify TypeScript here?

Minifying with Terser requires valid JavaScript — TypeScript's type annotations, interfaces, and generics aren't part of the JavaScript grammar, so they must be stripped by a TypeScript compiler first. Compile your TypeScript to JavaScript, then minify the output here.

Is minified JavaScript the same as obfuscated JavaScript?

No. Minification (what this tool does) shortens code for size — removing whitespace and renaming local variables — while keeping it straightforward to reverse-engineer with a beautifier. Obfuscation deliberately restructures code to make it hard to understand, which is a different goal with different tools.

Related tools