Skip to content
Agents tracked: 506 Releases (7d): 634 Agent status: 4 with issuesSince last limit reset: Claude 15d · Codex 0d For AI agents: Markdown Updated Nov 26, 2026

Prettier

One automatic style for all your code.

Linting and formattingNPM

GitHubWebsite

1. License

“to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software”

MIT allows use in paid and closed-source projects.

github.com/prettier/prettier/blob/main/LICENSE

From the package registry and GitHub, checked daily; card checked Nov 10, 2026. Tap a verdict to see its source.How we checkedReport an error

What Prettier does

Prettier is a free code formatter. It rewrites JavaScript, TypeScript, CSS, HTML, Markdown and other files in one tidy, consistent style, without changing what the code does. Your team and your AI assistant stop arguing about spaces and line breaks, and changes show only real edits.

What people build with it

Tidy a whole project at once

You inherit a project, or your assistant wrote files in mixed styles; one command rewrites every file in the same style.

Block unformatted code in checks

Every pull request is checked automatically, so code that skipped formatting fails the check instead of slipping in.

Format files on every commit

Each time someone saves work to version control, the changed files are formatted first, so nobody waits for the server check.

Neat code that your app writes

Your app or script generates code, settings files or snippets; pass the text through Prettier before saving or showing it.

Format code inside a web page

A code playground, a docs site or a snippet box in your app formats what people paste, right in the browser.

Keep assistant edits easy to review Idea

Run Prettier after your AI assistant changes files, so the review shows real changes, not moved spaces and quotes.

Prettier popularity

90 / 100
Gid Score, #10 overall
197M
downloads a week, npm
52.4K
GitHub stars
1,320
agent projects use it
Prettier: downloads per weeknpm, prettier 196,787,084
Prettier: GitHub starsprettier/prettier 52,444

Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated

How Prettier is used

  • Prettier is a dependency in 1,320 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (27.1% of the 4,867 JavaScript/TypeScript ones), #2 of 83 in linting and formatting.
  • Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 3,660; those are left out of every share on this page.
  • The most used alternative in our scan is Biome (354 projects).
  • Projects that use it most often also use ESLint (79.2%), TypeScript (83.9%), Husky (32.0%).

By coding agent

739 projects, 22.6%
678 projects, 22.3%
595 projects, 24.4%
151 projects, 31.9%
151 projects, 32.2%
93 projects, 27.1%
66 projects, 23.7%
33 projects, 23.6%

Often used with

In 79.2% of its projects
In 83.9% of its projects
In 32.0% of its projects
In 26.2% of its projects
In 49.2% of its projects
In 37.6% of its projects
In 44.3% of its projects
In 34.2% of its projects

Prettier in practice

Strengths

Reprints the whole program instead of checking rules

The docs say Prettier has no individual formatting rules to enable or disable. It reprints the entire program from scratch. The maintainers say this means "it’s not possible for the programmer to make a mistake there anymore."

Built to end style debates

The "Why Prettier?" page says the biggest reason to adopt it is to stop ongoing arguments over style.

Runs on save, in a pre-commit hook or in CI

The README says Prettier can run in your editor on save, in a pre-commit hook or in CI environments. It frames this as a way to keep a consistent style with no nit-picky comments in code review.

Users report formatting a whole codebase at once

The "Why Prettier?" page quotes users. One ran it against "one of our larger JS codebases" in under 13 seconds. Another says the biggest benefit was formatting the entire code base at once.

Watch out for

It catches no bugs

Prettier does nothing for code-quality rules such as <code>no-unused-vars</code>. The docs call those the most important linter rules, so you still need a linter.

You take its style, not yours

The docs admit the output may not match your preferences. They ask you to accept that "sacrifice" in exchange for automatic formatting.

Java, PHP, Ruby and Rust come from community plugins

The website lists Java, PHP, Ruby, Rust, TOML and XML under "Community Plugins", apart from the languages in its main list.

The README's long call, after Prettier wraps it

foo(
  reallyLongArg(),
  omgSoManyParameters(),
  IShouldRefactorThis(),
  isThereSeriouslyAnotherOne(),
);

More about Prettier

Funding
  • GitHub Sponsors: https://github.com/prettier
  • Open Collective: https://opencollective.com/prettier
  • thanks.dev: https://thanks.dev/u/gh/prettier
  • Tidelift: https://tidelift.com/funding/github/npm/prettier
  • Own page: https://github.com/prettier/prettier?sponsor=1
  • 41 GitHub sponsors

See all

Head to head
Packages around it
  • prettier-plugin-tailwindcss: Tailwind CSS plugin
  • prettier-plugin-svelte: Svelte plugin
  • prettier-plugin-organize-imports: Import organizing plugin
  • prettier-plugin-astro: Astro plugin
  • prettier-plugin-solidity: Solidity plugin
  • prettier-plugin-packagejson: package.json plugin
More in Linting and formatting

Alternatives

Prettier This page

MITGid 90197M/wk

Biome

Pick Biome when you want one fast tool that both formats and lints web code.

MIT OR Apache-2.0Gid 8230.3M/wk

oxfmt

Pick oxfmt when you want a fast JavaScript formatter from the Oxc compiler project.

Black

Pick Black when the code to format is Python.

Compare Prettier with another tool

Get started

Tell your AI assistant

“Add Prettier 3.9.10 as an exact dev dependency with an empty .prettierrc and a .prettierignore for build output, run npx prettier . --write once, add npx prettier . --check to CI, and add eslint-config-prettier if ESLint is used.”

  1. Install an exact version of Prettier in the project, so everyone formats the same way.

    npm install --save-dev --save-exact prettier@3.9.10

    From prettier.io/docs/install

  2. Format every file in the project.

    npx prettier . --write

    From prettier.io/docs/install

  3. If the project uses ESLint, add eslint-config-prettier so the two do not fight over style.

    npm install --save-dev eslint-config-prettier

    From prettier.io/docs/install

Rules for your agent

Paste into AGENTS.md or CLAUDE.md
## Prettier
- Use Prettier for formatting and a linter for catching bugs. Prettier does not handle code-quality rules such as `no-unused-vars`, `no-extra-bind` or `no-implicit-globals`.
- Do not look for individual formatting rules to toggle. Prettier has none and reprints the whole program from scratch.
- Linter formatting rules such as `max-len`, `no-mixed-spaces-and-tabs`, `keyword-spacing` and `comma-style` are the category the docs say Prettier makes unnecessary.
- Do not hand-wrap code for line length. Prettier re-prints with its own rules that take the maximum line length into account, wrapping code when necessary.
- For CI checks, the README links to the `list-different` section of the CLI docs.
- On an inconsistent existing codebase, the docs call running Prettier across it "a quick win".

Mistakes to avoid

const out = prettier.format(code, opts); then using out as a string
const out = await prettier.format(code, opts); (or @prettier/sync if you truly need synchronous code)

Since version 3 every public function returns a Promise; without await you get "[object Promise]".

npx prettier --write . in a project where Prettier is not installed
npm install --save-dev --save-exact prettier@3.9.10 first, then npx prettier . --write

npx then downloads the newest Prettier, which can format differently from the project's version.

In the browser: prettier.format(code, { parser: "babel", plugins: [babel] })
Load the estree plugin too: plugins: [babel, estree] (and postcss, html or markdown for those languages)

The standalone build loads no plugins by itself; in our run babel alone threw ConfigError: Couldn't find plugin for AST format "estree".

Adding eslint-plugin-prettier so formatting shows up as ESLint errors
Use eslint-config-prettier to switch off ESLint's style rules and run prettier --check separately

The docs say the plugin route is slower and fills the editor with red lines.

Passing a custom parser function in options.parser (Prettier 2 style)
Wrap the parser in a plugin object and pass it in options.plugins

The custom parser option was removed in 3.0 in favour of plugins.

Questions

Will Prettier change what my code does?

It should not. Its first rule is to output valid code that behaves exactly as before; the docs ask to report any case where it does not.

Does Prettier replace ESLint?

No. Prettier handles layout; a linter catches likely bugs. The docs suggest eslint-config-prettier to turn off ESLint's style rules.

Can I make it format exactly the way I like?

Only a little. There are a few options such as line width and quotes, and the team does not add new ones.

How do I keep one part of a file as I wrote it?

Put a // prettier-ignore comment above it in JavaScript; other languages have similar comments.

Why did the default trailing commas change after an upgrade?

In version 3.0 the default for trailing commas changed from "es5" to "all", so upgrades from version 2 add more commas.