JavaScript Formatter & Minifier
Beautify JavaScript with Prettier, or minify it. This tool beautifies and minifies JavaScript on one page — paste your code, pick a mode, and click. Everything runs on your device, nothing is sent to a server.
Everything runs in your browser. Your code is never sent to our servers.
Example
Example Input
const x={a:1,b:2}Example Output
const x = { a: 1, b: 2 };How to Use
- 1Choose Format or Minify mode at the top.
- 2Paste your JavaScript code into the Input field.
- 3If needed, set the indent width in "More settings".
- 4Click the button (or press Ctrl+Enter) to process. The result appears in the Output field.
- 5Click Copy to copy the result.
About the JavaScript Formatter
The JavaScript Formatter beautifies JS code using Prettier — an industry-standard style with consistent indentation, quotes, and semicolons — or minifies it for production.
How it works: Format runs Prettier (Babel parser) which parses the code into an AST then prints it back in a consistent style. Minify removes comments and whitespace for a small size.
Formatting JavaScript keeps code style consistent across a team, reduces diff noise, and makes code easier to read. Minify reduces file size for faster loads.
FAQ
Can this JavaScript tool both format and minify?
Yes. One page with a toggle — Format mode prettifies (beautifies) with indentation, and Minify mode compacts it. No need for two separate pages.
Is my code sent to a server?
No. JavaScript is processed entirely in your browser using JavaScript/WebAssembly. Your code never leaves your device.