Development

Code Formatter — Prettier Online

Free online code formatter powered by Prettier. Format JavaScript, TypeScript, HTML, Vue, CSS, SCSS, JSON, YAML, Markdown, and GraphQL with customizable options. No sign-up required.

Free to use No sign-up Runs in your browser

Tool workspace

What Is Code Formatter?

This tool uses Prettier, the industry-standard code formatter, to automatically format your code according to consistent style rules. Prettier supports JavaScript, TypeScript, HTML, Vue, CSS, SCSS, Less, JSON, YAML, Markdown, and GraphQL. It removes all original styling and enforces a consistent code style, making your codebase easier to read and maintain.

How to Use This Code Formatter

  1. 1Select the programming language from the dropdown menu.
  2. 2Paste your unformatted code into the input area, or click Load Sample to try an example.
  3. 3Adjust formatting options: tab width, print width, semicolons, and quote style.
  4. 4Click Format Code to format your code using Prettier.
  5. 5Copy the formatted output with the Copy button.

Common Use Cases

Quickly Format Messy Code

Paste code from Stack Overflow, GitHub issues, or chat messages and instantly format it for readability.

Standardize Code Style

Ensure consistent formatting across your team by using the same Prettier configuration.

Format Config Files

Pretty-print JSON, YAML, and other configuration files for easier editing and review.

Frequently asked questions

Does this tool send my code to a server?

No. All formatting runs entirely in your browser using Prettier's standalone build. Your code never leaves your device.

Which version of Prettier is used?

This tool uses the latest version of Prettier 3.x with all official language plugins.