JavaScript Formatter
Why use a private JavaScript formatter?
Source code is often the most sensitive thing a developer handles — unreleased features, internal API endpoints, embedded keys, proprietary business logic. Pasting it into an online beautifier that processes it on a server hands a copy to someone else.
formatvault formats JavaScript and TypeScript with prettier, the same formatter most JavaScript projects already use, running entirely in your browser. Your code never leaves your machine, and the output matches what Prettier produces locally with the same settings.
How it works
Prettier parses your code into a syntax tree using Babel (for JavaScript and JSX) or the TypeScript compiler's parser (for TypeScript and TSX), then prints it back out from scratch using consistent rules. That's why it can reformat anything from a one-line minified bundle to inconsistently indented legacy code. The code is never executed.
Formatting runs in a Web Worker so large files don't freeze the page, and the parser loads only the first time you format. Syntax errors are reported with the exact line and column, and the diff view shows exactly what Prettier changed. Need to shrink code for production instead? Use the JavaScript Minifier.
Common use cases
- Beautifying minified JavaScript to read or debug third-party code
- Formatting snippets copied from Stack Overflow, docs, or chat before pasting into a codebase
- Cleaning up inline scripts, bookmarklets, and tag manager snippets
- Checking how Prettier would format code with different settings before committing a .prettierrc
- Formatting TypeScript interfaces and types copied from API docs
- Normalising JSX from design-tool exports or generated components
- Spotting syntax errors quickly with line and column reporting
Frequently asked questions
- Is my code uploaded anywhere?
- No. Prettier runs in a Web Worker inside your browser. Your source code is never sent to a server, logged, or stored — closing the tab discards it.
- Does it run my JavaScript?
- No. The code is parsed into a syntax tree and printed back out. It is never evaluated, so formatting untrusted or malicious code is safe.
- Does it support JSX, TypeScript, and TSX?
- Yes. The JavaScript parser handles modern ECMAScript and JSX. Switch the parser to TypeScript for type annotations, interfaces, enums, generics, and TSX. Uploading a .ts or .tsx file selects the TypeScript parser automatically.
- Will the output match Prettier in my project?
- It uses the same Prettier engine. If you set the indent, quotes, semicolons, trailing commas, and line width to match your .prettierrc, the output will be the same as running Prettier locally.
- Why does it say my code is invalid?
- Prettier must parse the code before it can format it, so any syntax error stops formatting. The error bar shows the line and column. A common cause is TypeScript syntax (type annotations, interfaces) with the JavaScript parser selected.
- Can I un-minify or beautify minified JavaScript?
- Yes. Paste minified code and it is re-indented and wrapped into readable form. Variable names shortened by a minifier cannot be restored, but the structure becomes easy to follow.