What Prettier changes

Prettier Code Formatter

Prettier rewrites source to a consistent style inside a project. This page shows a typical before and after. It does not run Prettier and it does not accept a code upload.

Local processing Free to use No install

Before

function greet( name,excited )
{if(excited){return "Hello, "+name+"!"}return "Hello, "+name}

Typical result

function greet(name, excited) {
  if (excited) {
    return "Hello, " + name + "!";
  }
  return "Hello, " + name;
}

Static example. Markdown Viewer does not run Prettier or upload this code.

What Prettier rewrites

Prettier is an opinionated formatter. With a language it supports, it changes spacing, quotes, semicolons, and line breaks while leaving the program's behavior alone. The example above is a typical default style for a small JavaScript function. It is a static illustration, not output from this website.

Settings live in the project

A repository can set print width, quote style, semicolons, and trailing commas in a Prettier config file or in package.json. An editor format command or a local Prettier run applies those choices. This page does not read a config file and does not install Prettier.

Markdown without running Prettier

Prettier can format Markdown in a repository. MD Formatter is a separate browser tool. It adjusts heading spaces, unordered-list markers, and blank lines, and it reports unclosed fences, uneven tables, skipped headings, and empty links. It will not match Prettier's Markdown output.

Prettier code formatter FAQ

Does this page format my code with Prettier?

No. There is no Prettier execution here and no file upload. The example shows the kind of spacing change Prettier is known for.

Where should I run Prettier?

Run it in the project, through the editor or the Prettier command-line tool, so it can see that project's config and files.

Can Prettier format Python the way Ruff does?

Prettier's usual targets are the languages its core and plugins support, such as JavaScript, TypeScript, JSON, CSS, and Markdown. Python projects more often use Ruff's formatter. The Ruff page explains that difference.