Skip to content
SPECIFICTION
Get listed

Prettier vs rustfmt

Prettier

prettier.io

rustfmt

rust-lang.github.io

Side by side

FigurePrettierrustfmt
Price fromFreeFree
Free planYesYes
Free trial——
Open sourceYes—
WebYes—
WindowsYesYes
macOSYesYes
LinuxYesYes
APIYes—
Self-hostedYes—
Plans published21
Spec score · Code Formatting Tools8.5 (#2)8.0 (#10)
ConfigurationConfiguration can use JSON, YAML, TOML, JavaScript or TypeScript files, with overrides for selected files and directories.Configuration can be set in `rustfmt.toml` or `.rustfmt.toml`, and the default style conforms to the Rust style guide.
Editor integrationsThe official site lists integrations or support for VS Code, WebStorm, Visual Studio, Vim, Emacs, Sublime Text, Nova and Espresso.The README lists integrations or usage instructions for Vim, Emacs, Sublime Text 3, Atom, Visual Studio Code, and IntelliJ or CLion.

Plans

Prettier

  • Open-source PrettierFree
  • PrettierFree

Prettier pricing →

rustfmt

  • rustfmtFree

rustfmt pricing →

In their own words

Prettier

Prettier is an open-source code formatter that parses source files and prints them in a consistent style while accounting for line length. Its built-in languages include JavaScript, JSX, Angular, Vue, Flow, TypeScript, CSS, Less, SCSS, HTML, JSON, GraphQL, Markdown, YAML, LWC, and MJML. The command-line interface can write formatted files with --write or check formatting with --check in continuous integration. Listed editor integrations include VS Code, Emacs, Vim, Helix, Sublime Text, JetBrains IDEs, Visual Studio, and Espresso; formatting can run from a shortcut or on save. Prettier has configuration options but keeps them limited. Plugins can add languages and formatting rules, and languages outside the built-in set require a plugin. For ESLint integration, the installation guidance recommends eslint-config-prettier to disable rules that are unnecessary or may conflict. Prettier supports browser and JavaScript API use, along with Linux, macOS, and Windows. The listed plan is free. Commercial support and maintenance are available through the Tidelift Subscription.

Visit prettier.io

rustfmt

rustfmt formats Rust code according to style guidelines. It can format files directly or read code from standard input and write formatted output to standard output. With Cargo, `cargo fmt` formats binary and library targets in a crate and works with workspaces. A `rustfmt.toml` or `.rustfmt.toml` file can hold configuration, including stable and nightly-only options. For automated checks, `--check` returns code 0 when no formatting changes are needed and code 1 when changes would be made; it can be used in CI to fail a build on formatting differences. The README lists editor use with Vim, Emacs, Sublime Text 3, Atom, Visual Studio Code, IntelliJ, and CLion. Rustfmt is available on Windows, macOS, and Linux, and is distributed under the MIT License and Apache License 2.0. It does not attempt to format comments, and listed limitations also involve macros, unparsable code, fragments, and non-ASCII Unicode. Unstable settings require opt-in on nightly, and the README says the latest version requires the nightly toolchain.

Visit rust-lang.github.io