Same rules as your editor, without the install
Prettier is the de-facto formatter for JavaScript, TypeScript, HTML, CSS, JSON, Markdown, YAML and GraphQL. It is opinionated on purpose: no debates about where a brace goes, because everyone gets the same output. Running it in the browser means you can format a snippet you copied from a ticket, a Stack Overflow answer or a minified bundle without installing Node.js, and without pasting company code into an unknown server.
What each file type uses
| File type | Parser | Handles |
|---|---|---|
| .js / .mjs / .cjs / .jsx | Babel | ES2023, JSX, decorators, class fields |
| .ts / .tsx | TypeScript | Types, generics, enums, decorators |
| .json | JSON | Strict JSON with comments tolerated by the parser |
| .html / .vue | HTML | Tags, attributes, embedded script & style |
| .css / .scss / .less | PostCSS | Nesting, variables, mixins |
| .md | Markdown | Tables, lists, code fences |
| .yaml / .yml | YAML | Anchors, multi-line strings, comments |
| .graphql / .gql | GraphQL | Queries, fragments, schema definitions |
The options that actually matter
- Print width — how long a line may get before Prettier breaks it. 80 is the default; many teams use 100 or 120 on wide monitors.
- Tab width — 2 for JS/HTML, 4 is common in PHP and Java shops.
- Semicolons — turn off for standard-style JavaScript.
- Single quotes — on for most JS style guides, off for JSON (JSON requires double quotes regardless).
- Trailing commas —
allgives cleaner diffs in version control.
These map one-to-one to the options in a .prettierrc file, so you can copy the values
you already use in your project.
Why the first format takes a moment
The Prettier engine plus its language parsers is roughly a megabyte of JavaScript. Instead of slowing every page on the site, it is downloaded and compiled only when you open this tool — and only once per visit. After that every reformat is instant and works with no network connection.
Privacy and limits
Source code can contain API keys, internal hostnames and proprietary logic. This tool never sends it anywhere: parsing and printing happen on your CPU. There is no file-size hard limit; formatting becomes noticeably slower above roughly 1–2 MB, and very large minified bundles are better handled by the CLI in a CI step.
Related reading: format JSON safely, or head to the JSON Formatter if you only need validation plus error locations.