{
 "kind": "tool",
 "slug": "prettier",
 "path": "tools/prettier/",
 "name": "Prettier",
 "maker": null,
 "density": "full",
 "crumbs": [
  [
   "Tools",
   "tools/"
  ],
  [
   "Linting and formatting",
   "tools/lint-format/"
  ]
 ],
 "lead": "One automatic style for all your code.",
 "chips": [
  {
   "label": "Linting and formatting",
   "path": "tools/lint-format/"
  },
  {
   "label": "NPM"
  }
 ],
 "primary": {
  "label": "Copy install command",
  "copy": "npm install prettier"
 },
 "links": [
  {
   "label": "GitHub",
   "href": "https://github.com/prettier/prettier"
  },
  {
   "label": "Website",
   "href": "https://prettier.io"
  }
 ],
 "track": "New versions, deprecation and license changes on your dashboard",
 "verdicts": [
  {
   "key": "license",
   "label": "License",
   "value": "MIT",
   "status": "yes",
   "sub": "Use it in paid apps",
   "quote": "to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software",
   "note": "MIT allows use in paid and closed-source projects.",
   "src": "https://github.com/prettier/prettier/blob/main/LICENSE"
  },
  {
   "key": "maint",
   "label": "Maintained",
   "value": "Maintained",
   "status": "yes",
   "sub": "Last change Nov 23, 2026",
   "note": "Latest GitHub release Nov 12, 2026. ",
   "src": "https://github.com/prettier/prettier"
  },
  {
   "key": "pop",
   "label": "Used by agents' projects",
   "value": "1,320 projects",
   "status": "info",
   "sub": "#2 of 83 in its category",
   "note": "Dependency in 1,320 public GitHub projects set up for AI coding agents that we scanned (21.1%).",
   "src": null
  },
  {
   "key": "agent",
   "label": "Agent access",
   "value": "Docs for agents",
   "status": "yes",
   "sub": "llms.txt",
   "note": "Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.",
   "src": "https://prettier.io/llms.txt"
  }
 ],
 "vfoot": "From the package registry and GitHub, checked daily; card checked Nov 10, 2026.",
 "blocks": [
  {
   "id": "overview",
   "nav": "Overview",
   "h2": "What Prettier does",
   "parts": [
    {
     "t": "prose",
     "text": "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."
    },
    {
     "t": "h3",
     "text": "What people build with it"
    },
    {
     "t": "uses",
     "items": [
      {
       "title": "Tidy a whole project at once",
       "text": "You inherit a project, or your assistant wrote files in mixed styles; one command rewrites every file in the same style.",
       "idea": false
      },
      {
       "title": "Block unformatted code in checks",
       "text": "Every pull request is checked automatically, so code that skipped formatting fails the check instead of slipping in.",
       "idea": false
      },
      {
       "title": "Format files on every commit",
       "text": "Each time someone saves work to version control, the changed files are formatted first, so nobody waits for the server check.",
       "idea": false
      },
      {
       "title": "Neat code that your app writes",
       "text": "Your app or script generates code, settings files or snippets; pass the text through Prettier before saving or showing it.",
       "idea": false
      },
      {
       "title": "Format code inside a web page",
       "text": "A code playground, a docs site or a snippet box in your app formats what people paste, right in the browser.",
       "idea": false
      },
      {
       "title": "Keep assistant edits easy to review",
       "text": "Run Prettier after your AI assistant changes files, so the review shows real changes, not moved spaces and quotes.",
       "idea": true
      }
     ]
    }
   ]
  },
  {
   "id": "popularity",
   "nav": "Popularity",
   "h2": "Prettier popularity",
   "parts": [
    {
     "t": "stats",
     "items": [
      {
       "n": "90",
       "of": "/ 100",
       "l": "Gid Score, #10 overall"
      },
      {
       "n": "197M",
       "l": "downloads a week, npm"
      },
      {
       "n": "52.4K",
       "l": "GitHub stars"
      },
      {
       "n": "1,320",
       "l": "agent projects use it"
      }
     ]
    },
    {
     "t": "small",
     "text": "Gid Score measures public popularity and activity, not quality.",
     "link": "How the Gid Score is calculated",
     "path": "tools/top/"
    }
   ]
  },
  {
   "id": "usage",
   "nav": "How it is used",
   "h2": "How Prettier is used",
   "parts": [
    {
     "t": "list",
     "items": [
      "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%)."
     ]
    },
    {
     "t": "h3",
     "text": "By coding agent"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "739 projects, 22.6%",
       "v": "Claude Code",
       "path": "agents/claude-code/"
      },
      {
       "l": "678 projects, 22.3%",
       "v": "GitHub Copilot",
       "path": "agents/github-copilot/"
      },
      {
       "l": "595 projects, 24.4%",
       "v": "Cursor",
       "path": "agents/cursor/"
      },
      {
       "l": "151 projects, 31.9%",
       "v": "Gemini CLI",
       "path": "agents/gemini-cli/"
      },
      {
       "l": "151 projects, 32.2%",
       "v": "OpenAI Codex",
       "path": "agents/openai-codex/"
      },
      {
       "l": "93 projects, 27.1%",
       "v": "OpenCode",
       "path": "agents/opencode/"
      },
      {
       "l": "66 projects, 23.7%",
       "v": "Devin Desktop",
       "path": "agents/devin-desktop/"
      },
      {
       "l": "33 projects, 23.6%",
       "v": "Kiro",
       "path": "agents/kiro/"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Often used with"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "In 79.2% of its projects",
       "v": "ESLint",
       "path": "tools/eslint/"
      },
      {
       "l": "In 83.9% of its projects",
       "v": "TypeScript",
       "path": "tools/typescript/"
      },
      {
       "l": "In 32.0% of its projects",
       "v": "Husky",
       "path": "tools/husky/"
      },
      {
       "l": "In 26.2% of its projects",
       "v": "lint-staged",
       "path": "tools/lint-staged/"
      },
      {
       "l": "In 49.2% of its projects",
       "v": "Tailwind CSS",
       "path": "tools/tailwindcss/"
      },
      {
       "l": "In 37.6% of its projects",
       "v": "Vitest",
       "path": "tools/vitest/"
      },
      {
       "l": "In 44.3% of its projects",
       "v": "React",
       "path": "tools/react/"
      },
      {
       "l": "In 34.2% of its projects",
       "v": "Vite",
       "path": "tools/vite/"
      }
     ]
    }
   ]
  },
  {
   "id": "profile",
   "nav": "Profile",
   "h2": "Prettier in practice",
   "parts": [
    {
     "t": "h3",
     "text": "Strengths"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "Reprints the whole program instead of checking rules",
       "v": "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.\""
      },
      {
       "l": "Built to end style debates",
       "v": "The \"Why Prettier?\" page says the biggest reason to adopt it is to stop ongoing arguments over style."
      },
      {
       "l": "Runs on save, in a pre-commit hook or in CI",
       "v": "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."
      },
      {
       "l": "Users report formatting a whole codebase at once",
       "v": "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."
      }
     ]
    },
    {
     "t": "h3",
     "text": "Watch out for"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "It catches no bugs",
       "v": "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."
      },
      {
       "l": "You take its style, not yours",
       "v": "The docs admit the output may not match your preferences. They ask you to accept that \"sacrifice\" in exchange for automatic formatting."
      },
      {
       "l": "Java, PHP, Ruby and Rust come from community plugins",
       "v": "The website lists Java, PHP, Ruby, Rust, TOML and XML under \"Community Plugins\", apart from the languages in its main list."
      }
     ]
    },
    {
     "t": "h3",
     "text": "The README's long call, after Prettier wraps it"
    },
    {
     "t": "tabs",
     "label": "Example",
     "items": [
      {
       "tab": "Js",
       "code": "foo(\n  reallyLongArg(),\n  omgSoManyParameters(),\n  IShouldRefactorThis(),\n  isThereSeriouslyAnotherOne(),\n);"
      }
     ]
    }
   ]
  },
  {
   "id": "more",
   "nav": null,
   "spy_as": "profile",
   "h2": "More about Prettier",
   "parts": [
    {
     "t": "more",
     "items": [
      {
       "title": "Funding",
       "path": "tools/funding/",
       "items": [
        "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"
       ]
      },
      {
       "title": "Head to head",
       "items": [
        {
         "text": "Prettier vs Biome",
         "note": "used together in 40 projects",
         "path": "tools/compare/prettier-vs-biome/"
        }
       ]
      },
      {
       "title": "Packages around it",
       "items": [
        "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"
       ]
      },
      {
       "title": "More in Linting and formatting",
       "path": "tools/lint-format/",
       "items": [
        {
         "text": "ESLint",
         "path": "tools/eslint/"
        },
        {
         "text": "oxlint",
         "path": "tools/oxlint/"
        },
        {
         "text": "oxfmt",
         "path": "tools/oxfmt/"
        },
        {
         "text": "Knip",
         "path": "tools/knip/"
        },
        {
         "text": "stylelint",
         "path": "tools/stylelint/"
        },
        {
         "text": "ESLint Import Resolver TypeScript",
         "path": "tools/eslint-import-resolver-typescript/"
        },
        {
         "text": "oxlint-tsgolint",
         "path": "tools/oxlint-tsgolint/"
        },
        {
         "text": "Black",
         "path": "tools/black/"
        }
       ]
      }
     ]
    }
   ]
  },
  {
   "id": "alternatives",
   "nav": "Alternatives",
   "h2": "Alternatives",
   "parts": [
    {
     "t": "alts",
     "items": [
      {
       "name": "Prettier",
       "me": true,
       "facts": [
        "MIT",
        "Gid 90",
        "197M/wk"
       ]
      },
      {
       "name": "Biome",
       "why": "Pick Biome when you want one fast tool that both formats and lints web code.",
       "path": "tools/biomejs/",
       "facts": [
        "MIT OR Apache-2.0",
        "Gid 82",
        "30.3M/wk"
       ]
      },
      {
       "name": "oxfmt",
       "why": "Pick oxfmt when you want a fast JavaScript formatter from the Oxc compiler project.",
       "path": "tools/oxfmt/",
       "facts": []
      },
      {
       "name": "Black",
       "why": "Pick Black when the code to format is Python.",
       "path": "tools/black/",
       "facts": []
      }
     ],
     "more": "Compare Prettier with another tool",
     "more_path": "tools/compare/"
    }
   ]
  },
  {
   "id": "start",
   "nav": "Get started",
   "h2": "Get started",
   "parts": [
    {
     "t": "prompt",
     "text": "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."
    },
    {
     "t": "steps",
     "items": [
      {
       "text": "Install an exact version of Prettier in the project, so everyone formats the same way.",
       "code": "npm install --save-dev --save-exact prettier@3.9.10",
       "src": "https://prettier.io/docs/install"
      },
      {
       "text": "Format every file in the project.",
       "code": "npx prettier . --write",
       "src": "https://prettier.io/docs/install"
      },
      {
       "text": "If the project uses ESLint, add eslint-config-prettier so the two do not fight over style.",
       "code": "npm install --save-dev eslint-config-prettier",
       "src": "https://prettier.io/docs/install"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Rules for your agent"
    },
    {
     "t": "rules",
     "label": "Paste into AGENTS.md or CLAUDE.md",
     "text": "## Prettier\n- 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`.\n- Do not look for individual formatting rules to toggle. Prettier has none and reprints the whole program from scratch.\n- 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.\n- 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.\n- For CI checks, the README links to the `list-different` section of the CLI docs.\n- On an inconsistent existing codebase, the docs call running Prettier across it \"a quick win\".\n"
    },
    {
     "t": "h3",
     "text": "Mistakes to avoid"
    },
    {
     "t": "mistakes",
     "items": [
      {
       "dont": "const out = prettier.format(code, opts); then using out as a string",
       "fix": "const out = await prettier.format(code, opts); (or @prettier/sync if you truly need synchronous code)",
       "why": "Since version 3 every public function returns a Promise; without await you get \"[object Promise]\"."
      },
      {
       "dont": "npx prettier --write . in a project where Prettier is not installed",
       "fix": "npm install --save-dev --save-exact prettier@3.9.10 first, then npx prettier . --write",
       "why": "npx then downloads the newest Prettier, which can format differently from the project's version."
      },
      {
       "dont": "In the browser: prettier.format(code, { parser: \"babel\", plugins: [babel] })",
       "fix": "Load the estree plugin too: plugins: [babel, estree] (and postcss, html or markdown for those languages)",
       "why": "The standalone build loads no plugins by itself; in our run babel alone threw ConfigError: Couldn't find plugin for AST format \"estree\"."
      },
      {
       "dont": "Adding eslint-plugin-prettier so formatting shows up as ESLint errors",
       "fix": "Use eslint-config-prettier to switch off ESLint's style rules and run prettier --check separately",
       "why": "The docs say the plugin route is slower and fills the editor with red lines."
      },
      {
       "dont": "Passing a custom parser function in options.parser (Prettier 2 style)",
       "fix": "Wrap the parser in a plugin object and pass it in options.plugins",
       "why": "The custom parser option was removed in 3.0 in favour of plugins."
      }
     ]
    }
   ]
  },
  {
   "id": "faq",
   "nav": "Questions",
   "h2": "Questions",
   "parts": [
    {
     "t": "faq",
     "items": [
      {
       "q": "Will Prettier change what my code does?",
       "a": "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.",
       "evidence": {
        "url": "https://prettier.io/docs/rationale",
        "quote": "The first requirement of Prettier is to output valid code that has the exact same behavior as before formatting."
       }
      },
      {
       "q": "Does Prettier replace ESLint?",
       "a": "No. Prettier handles layout; a linter catches likely bugs. The docs suggest eslint-config-prettier to turn off ESLint's style rules.",
       "evidence": {
        "url": "https://prettier.io/docs/comparison",
        "quote": "Prettier does nothing to help with those kind of rules."
       }
      },
      {
       "q": "Can I make it format exactly the way I like?",
       "a": "Only a little. There are a few options such as line width and quotes, and the team does not add new ones.",
       "evidence": {
        "url": "https://prettier.io/docs/option-philosophy",
        "quote": "Prettier is not a kitchen-sink code formatter that attempts to print your code in any way you wish."
       }
      },
      {
       "q": "How do I keep one part of a file as I wrote it?",
       "a": "Put a // prettier-ignore comment above it in JavaScript; other languages have similar comments.",
       "evidence": {
        "url": "https://prettier.io/docs/ignore",
        "quote": "A JavaScript comment of // prettier-ignore will exclude the next node in the abstract syntax tree from formatting."
       }
      },
      {
       "q": "Why did the default trailing commas change after an upgrade?",
       "a": "In version 3.0 the default for trailing commas changed from \"es5\" to \"all\", so upgrades from version 2 add more commas.",
       "evidence": {
        "url": "https://prettier.io/docs/options",
        "quote": "Default value changed from es5 to all in v3.0.0"
       }
      }
     ]
    }
   ]
  }
 ],
 "glance": [
  [
   "Package",
   "npm prettier"
  ],
  [
   "Category",
   "Linting and formatting"
  ],
  [
   "License",
   "MIT"
  ],
  [
   "Latest version",
   "3.9.10, October 10, 2026"
  ],
  [
   "On GitHub since",
   "November 2016"
  ],
  [
   "Gid Score",
   "89.7"
  ],
  [
   "Rank in category",
   "#2 of 83"
  ],
  [
   "GitHub",
   "prettier/prettier"
  ],
  [
   "Last change",
   "Nov 23, 2026"
  ]
 ],
 "good": [
  "Output can change between releases, even small ones. Pin one exact version so teammates and tools do not reformat each other's work.",
  "It only fixes layout. It does not find bugs, so pair it with a linter such as ESLint.",
  "It has few settings on purpose, and the team does not plan to add more."
 ],
 "checked_line": "Read by AgentGid from 19 official pages, card checked Nov 10, 2026; numbers update daily.",
 "logo": "https://agentgid.com/media/avatars/prettier.png"
}