Overview
Prettier is a code formatter. You run it over your source files and it rewrites them in one consistent style: line length, indentation, quotes, brackets and so on. It is described as opinionated, meaning it deliberately offers few options, so a team adopts its style and stops debating formatting in code reviews.
Out of the box it handles JavaScript, JSX, TypeScript, Flow and JSON; CSS, Less and SCSS; HTML, Vue, Angular and Handlebars templates; Markdown, YAML and GraphQL. Community plugins add more languages, including PHP, Java, Ruby, Rust, TOML and XML. Most people use it through an editor integration that formats a file on save; integrations are listed for VS Code, Vim, Emacs, Sublime Text, Visual Studio and WebStorm, among others.
Prettier is installed into a project as a development dependency with npm, yarn, pnpm or bun, and run from the command line. The write option reformats files in place, and the check option only reports unformatted files, which is the recommended mode for CI. It can also run in a Git pre-commit hook. There is an online playground on the website for trying it without installing anything. The project is funded by donations and sponsors.
Categories
Features
- Formats JavaScript, TypeScript, JSX, Flow and JSON
- Formats CSS, Less, SCSS, HTML, Vue, Angular and Handlebars
- Formats Markdown, YAML and GraphQL
- Community plugins for PHP, Java, Ruby, Rust, TOML, XML and more
- Editor integrations with format on save
- Command-line write and check modes for scripts and CI
- Ignore file for excluding paths, and it respects .gitignore
- Online playground for trying it in the browser
Privacy
See the official privacy policy. Prettier runs locally on your own files; the project website loads Google Analytics.
Pros & Cons
Pros
- Free and open source
- Few options, so there is little to argue about or configure
- One tool covers many web languages
- No account needed, and the playground works without installing
Cons
- Very limited control over style: you largely accept its choices
- Installed through JavaScript package managers, which is extra setup for projects in other languages
- Languages outside the core set depend on community plugins
- Needs a companion config to stop ESLint style rules clashing with it
Community Reviews (0)
No written reviews yet — be the first to rate this tool.
Similar Tools
-
Code Beautifiers · Beautifier.io
Beautifies JavaScript, HTML, and CSS.
Open Source No Signup Web