Skip to content

Prettier

An opinionated code formatter that rewrites your code in one consistent style.

Stars
52.4k
Forks
5k
Licence
MIT
Language
JavaScript
Last update
4 days ago
Type
Dev tool

What it is

Prettier reads your source code, parses it, and reprints it using its own fixed formatting rules, wrapping lines when they exceed a maximum length. It supports many languages, including JavaScript, TypeScript, CSS, JSON, Markdown, and YAML. Teams use it so everyone's code looks the same and code reviews don't turn into debates about spacing and line breaks.

  • Format a JavaScript or TypeScript file on save in your editor
  • Run Prettier in a pre-commit hook so only consistently formatted code is committed
  • Check formatting in CI environments so style problems are caught automatically
  • Format CSS, SCSS, Less, HTML, Vue, or YAML files in the same project

Great for

  • Teams that want one shared code style without writing their own rules
  • Developers who want formatting handled automatically on save
  • Projects that use JavaScript, TypeScript, CSS, or Markdown
  • Setups that run formatting in a pre-commit hook or CI check

Not ideal for

  • People who want to customize every formatting detail, since Prettier is opinionated and offers limited options (the README links to an Options page, which was not reviewed here)
  • Projects in languages not listed in the README, unless a plugin exists for them
Step-by-step guide: how to use PrettierInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: Node.js (version not stated in the README excerpt)

    Install with npm (from the project's install docs; README excerpt does not include the command)

    git clone https://github.com/prettier/prettier
  2. 2

    Run it

    • Install Prettier using the instructions at https://prettier.io/docs/install
    • Run Prettier on a file from the command line or your editor
    • Try the online Playground at https://prettier.io/playground/ to see output before installing
  3. 3

    Get the most out of it

    • Connect Prettier to your editor so it formats on save (the README links to editor setup docs)
    • Add a pre-commit hook to format staged files automatically (README links to pre-commit docs)
    • Use Prettier in CI to check that code is formatted (README links to CLI docs)
    • Use the Playground to preview how your code will be formatted before committing to a setup

Downloads

Strengths

  • Removes formatting debates from code review by applying one consistent style
  • Supports many languages in one tool, as listed in the README
  • Widely used, with an active repository and a recent release (3.9.10)

Trade-offs

  • Its opinionated style means limited control over individual formatting choices
  • Teams with an established, different style may need to reformat existing code, which creates large diffs

How it compares

ProjectStarsTypeLevelUpdatedBest for
prettier (this)52.4kDev toolbeginner4 days agoTeams that want one shared code style without writing their own rules
eslint27.6kDev toolintermediate4 days agoJavaScript developers who want automatic checks on their code
coloruicss12.4kLibrarybeginner2.6 years agoDevelopers building WeChat mini programs who want quick, colorful styling
esbuild40.1kDev toolintermediate3 months agoDevelopers who want fast builds for JavaScript, TypeScript, or CSS projects
postcss29kDev toolintermediate4 days agoWeb developers who want to automate CSS fixes such as vendor prefixes
mitosis14.5kDev toolintermediate8 days agoTeams maintaining the same UI components across more than one framework

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.