How to use the JavaScript Formatter
- 1
Paste JavaScript or drop a .js / .jsx / .mjs file.
- 2
Choose Format to beautify or Minify to compress with Terser.
- 3
Copy the result or download it.
Features
- Prettier formatting
- Opinionated, consistent output with configurable quotes and semicolons.
- Terser minification
- Mangle and compress code for production-ready output.
- Modern syntax
- ES2024+, JSX, optional chaining, top-level await and more.
- Readable errors
- Syntax errors include the line and column.
Frequently asked questions
What's the difference between formatting and minifying?
Formatting adds consistent indentation and line breaks for humans. Minifying removes whitespace and shortens variable names to make files smaller for browsers.
Can I format TypeScript here?
For TypeScript, use the Code Formatter tool and select TypeScript as the language.
Are my scripts uploaded to a server?
No. All processing happens locally in your browser using JavaScript and WebAssembly. Your scripts never leave your device, and nothing is stored or logged.