Code Beautifier
Reformat HTML, CSS, JavaScript, TypeScript, JSON or Markdown with Prettier, entirely in your browser.
Results are provided as is, for general information. Check anything important before relying on it. See the Terms of Use.
About this tool
Paste HTML, CSS, SCSS, Less, JavaScript, TypeScript, JSON or Markdown and get it reindented and consistently formatted by Prettier's standalone build — the same engine editors run on save. Print width, indent width, and (for JavaScript and TypeScript) semicolons and quote style are adjustable. Invalid syntax is reported with the line and column Prettier stopped at, rather than silently returning half a result. Prettier's parser for the language you pick is loaded on demand — choosing CSS never downloads the multi-megabyte TypeScript parser — and everything runs in your browser, so nothing is uploaded.
When to use it
Questions
Does it change my code's behaviour?
No. Prettier only rewrites whitespace, line breaks, quote style and a few equivalent syntactic forms (it will add semicolons, or turn double quotes into single). It never renames anything, reorders logic, or removes code. The formatted output runs identically to the input.
Can it minify instead of expand?
No — this tool only formats for readability. Minification is a build-tool job with different trade-offs (and undoing it safely is exactly what formatting a minified file here does). For JSON specifically, the JSON Formatter tool has a minify option.
Why is there no 'auto-detect language' option?
Language detection from a snippet is unreliable — a block of JSON is also valid JavaScript, SCSS is a superset of CSS, and a fragment of HTML with a script tag is ambiguous. Picking the parser explicitly means the result is predictable and the error messages point at the right thing.
Is my code sent anywhere?
No. Prettier's browser build is downloaded to your device the first time you format a given language, then the formatting happens entirely in the page. You can format, go offline, and it still works.