Inconsistent formatting is the silent productivity tax of every codebase. Two engineers who disagree about semicolons or trailing commas will spend more time arguing about diffs than fixing bugs. The industry settled this argument in 2017 when Prettier shipped: pick a config once, run the formatter on save, and the rest is mechanical. By 2026, Prettier is the default formatter in VS Code, the default in Next.js / Remix / Vite scaffolds, and a hard requirement on most engineering teams.
Our JavaScript formatter runs Prettier 3 in your browser via WebAssembly. It handles JavaScript (ES2024), TypeScript, JSX, TSX, JSON, and Markdown code blocks. Use it to beautify a one-liner you copied from a build output, to reformat code from a tutorial that uses different indentation than your project, or to apply Prettier without installing anything. This guide covers every option, the differences vs Beautify.js, and when to use a formatter vs a minifier.
Prettier options that matter (and the defaults to start with)
| Option | Default | When to change |
|---|---|---|
printWidth |
80 | 100 or 120 if your team uses wide monitors |
tabWidth |
2 | 4 only if you write Java/C# style or for accessibility |
useTabs |
false | true for accessibility (screen readers can adjust width) |
semi |
true | false if your team writes Standard JS / no-semi style |
singleQuote |
false | true for most codebases (preferred by Airbnb / Standard) |
trailingComma |
“all” | “es5” if targeting old browsers (rare in 2026) |
bracketSpacing |
true | false to compress (against the Prettier philosophy) |
arrowParens |
“always” | “avoid” if your style guide forbids parens around single arrow args |
The defaults are deliberately opinionated. Prettier’s design philosophy is “you don’t get to choose 30 micro-options” — pick a print width and a quote style and stop bikeshedding. Most teams adjust at most 3 fields.
Prettier vs Beautify.js vs ESLint –fix
- Prettier: opinionated, fast, only handles formatting (no logic). Makes formatting a non-decision.
- Beautify.js: the older formatter (jsbeautify). More configurable, less consistent. Still acceptable for one-off cleanup but hasn’t been the team standard since 2018.
- ESLint –fix: a linter that can reformat. Powerful but slower than Prettier and requires you to author the rules. Most teams run ESLint and Prettier — Prettier handles whitespace, ESLint handles correctness (unused vars, missing await).
- Editor-only: VS Code’s built-in formatter is OK for ad-hoc edits but doesn’t enforce a project-wide style.
Use Prettier for production code; use this browser tool for one-off snippets where installing Prettier locally is overkill.
How to format JavaScript in your browser
- Open the JavaScript formatter
- Paste your code (works for JS, TS, JSX, TSX, JSON)
- Pick parser (auto-detect usually works) and adjust print width, semis, quotes
- Click Format — output appears with syntax highlighting
- Click Copy or Download
TypeScript and JSX formatting (the parser matters)
Prettier auto-detects in most cases, but ambiguity is real: <Foo>bar</Foo> is JSX in a .jsx file and a TypeScript type assertion in a .ts file. Tell the formatter explicitly which parser to use:
babel— JS with JSX (default for most React code)typescript— TS without JSXbabel-ts— TS with JSX (TSX files)json— JSON / JSON5 / package.jsonflow— Facebook’s Flow type annotations (declining usage)
Picking the wrong parser produces silent failures — Prettier returns the input unchanged. If formatting “did nothing”, switch the parser.
Common gotchas
- Don’t format generated code. If a file ends in
.min.js, don’t re-format it — variable names are mangled, formatting won’t recover them, and you’ll bloat your repo with un-debuggable output. - Prettier won’t fix logic. Missing semicolons in ASI-trap positions (
return\n[1,2,3]) get a semicolon inserted — the code’s behaviour stays “broken”. Use ESLint’sno-unreachablefor those. - Magic strings inside string templates aren’t formatted. Code inside template literals (
`code goes here`) is treated as a string. To format embedded code, extract it. - JSON allows trailing commas only with parser “json5”. Standard JSON doesn’t permit them. The default
jsonparser strips trailing commas. - Prettier 3 changed defaults from Prettier 2.
trailingCommadefault went from"es5"to"all". If you regenerate a file with v3 and check it in, expect comma-only diff noise. - Auto-format on save can fight version control. If two devs use different Prettier versions, every save generates noise. Pin a version with
"prettier": "3.x"in yourpackage.jsonand commit the.prettierrc.
When NOT to use a browser formatter
For a real codebase, install Prettier locally (npm i -D prettier), commit a .prettierrc, and configure your editor to format on save. That gives every collaborator the same output and removes formatting from code review entirely. Use this browser tool for one-off snippets, code from a tutorial that disagrees with your style, copy-paste from build logs, or quick previews of how Prettier would render code in a project that doesn’t have it set up yet.
Frequently asked questions
Does this support TypeScript and JSX?
Yes. The formatter ships Prettier 3 with all the standard parsers: babel (JS+JSX), typescript (TS), babel-ts (TSX), json, and flow. Auto-detect picks the right parser from the file extension when you upload, or you can override the parser manually for paste-mode.
Can I save my Prettier config?
Settings persist in your browser’s localStorage between sessions. There’s also a “Copy as .prettierrc” button that exports your settings as a JSON file ready to drop into a project root.
What’s the difference between formatting and minifying?
Opposite jobs. Formatting adds whitespace and indentation for readability (build-time → editor view). Minifying removes whitespace and renames variables to shrink file size (editor → build → CDN). Use a formatter while you’re writing code; use a minifier as the last step before deploy.
Can I format minified code back into readable code?
Partially. Whitespace and indentation are restored; structure is recovered. But variable names that were mangled to a, b, c stay mangled — that information is gone unless you have the original source map. Use this for “what does this function do?”-grade reverse engineering, not for full source recovery.
Is my code uploaded?
No. Prettier runs in your browser via WebAssembly. Code is never uploaded to our servers — safe for proprietary, pre-release, or sensitive code.
What’s the size limit?
Effectively your browser’s available memory. Prettier handles files of several MB without trouble; very large files (10K+ lines) can take 2–5 seconds. For batch formatting of many files, use Prettier locally via npx prettier --write instead.
Related tools and guides
![JavaScript Formatter: Beautify JS with Prettier [2026]](https://simpletool.io/blog/wp-content/uploads/2026/05/javascript-formatter.png)