Code Formatter (Prettier)

Formats JS, TS, JSON, CSS, HTML and Markdown with Prettier.

The Code Formatter runs Prettier in your browser to clean up and beautify source code with consistent indentation and style. It supports JavaScript, TypeScript, JSON, CSS, SCSS, LESS, HTML and Markdown, so you can paste messy or minified code and get a readable, formatted result. It is handy whenever you want quick formatting without installing Prettier or wiring it into your editor.

Common uses

  • Reformat minified or poorly indented JavaScript and TypeScript into readable code
  • Pretty-print compact JSON payloads from API responses or logs
  • Clean up CSS, SCSS or LESS stylesheets with consistent spacing
  • Tidy HTML markup pasted from another source
  • Format Markdown documents before committing them
  • Quickly format a snippet when Prettier is not set up in your local environment

FAQ

Is my code sent to a server?

No. Formatting runs entirely in your browser using Prettier's standalone build, and nothing you paste is uploaded or stored anywhere.

Which languages and formats are supported?

JavaScript, TypeScript, JSON, CSS, SCSS, LESS, HTML and Markdown. You pick the language from the Language option before formatting.

Can I configure options like print width, tabs or semicolons?

Not currently. The tool formats with Prettier's default settings; the only choice exposed is the language/parser to use.

What happens if my code has a syntax error?

Prettier needs parseable input, so invalid syntax for the selected language will produce a parse error instead of formatted output. Make sure the language selection matches your code.

Does it use the real Prettier?

Yes. It loads Prettier's standalone engine and the matching language plugins on demand, so output matches what Prettier produces with its defaults.

Related tools

  • GraphQL Formatter
  • Syntax Highlighter
  • SQL Formatter
  • SQL Minify