Runs offline Prettier engine 13 languages Your config

Code Prettifier

The same formatting engine your editor uses — Prettier — compiled for the browser. Paste minified JavaScript, a wall of HTML or a one-line CSS file, tweak the rules, and get code you can actually read. Nothing is sent to a server.

Code workspace Waiting for code
Input Ctrl/⌘ + Enter to format
— Prettier · runs locally
Formatted output

Formatted code appears here.
The engine loads once, then works offline.

Prettier runs as WebAssembly-free JS in this tab.

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 typeParserHandles
.js / .mjs / .cjs / .jsxBabelES2023, JSX, decorators, class fields
.ts / .tsxTypeScriptTypes, generics, enums, decorators
.jsonJSONStrict JSON with comments tolerated by the parser
.html / .vueHTMLTags, attributes, embedded script & style
.css / .scss / .lessPostCSSNesting, variables, mixins
.mdMarkdownTables, lists, code fences
.yaml / .ymlYAMLAnchors, multi-line strings, comments
.graphql / .gqlGraphQLQueries, 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 — all gives 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.

Frequently asked questions

Is this really Prettier, or a look-alike?
It is the official prettier/standalone build with the same parser plugins, running in your browser. Output is byte-for-byte what the CLI produces with the same options.
Will it format PHP, Python, Java or C#?
No — Prettier itself does not support those languages. For PHP there is a Prettier plugin, and Python has Black; both need a real runtime and are better run locally.
Can it minify code?
No. Prettier is a pretty-printer and deliberately does not minify — use esbuild, terser or SWC for that. For JSON specifically, the JSON Formatter has a Minify button.
Why did formatting fail with a syntax error?
Prettier parses before it prints, so genuinely invalid code is rejected with a line and column. The most common cause is a mismatched language selector — for example formatting TypeScript with the Babel parser, or JSON with the JavaScript parser.
Does it work offline?
After the page has loaded once, yes. Reload with the network disabled and the engine comes from the browser cache in most setups; otherwise just reconnect briefly.