
Prettier, dprint and Spotless are the first three tools on this shortlist for keeping one consistent code style across a repository with several languages, enforced through pre-commit hooks and CI. It is written for teams maintaining polyglot and monorepo codebases. The remaining four tools (Black, clang-format, shfmt and google-java-format) each cover a specific language and fit alongside a multi-language formatter.
The shortlist
Side-by-side comparison
| Tool | Who it is for | Platforms | Pricing |
|---|---|---|---|
| Teams that want an opinionated formatter in editors and git hooks | Most editors; online try-it option available | Pricing on prettier.io | |
| Monorepos that want one formatter CLI and one config | Single static binary; install via shell script, PowerShell, npm, Homebrew or Cargo | Pricing on dprint.dev | |
| Gradle, Maven or sbt based repositories | Gradle, Maven, sbt and other build tools; VS Code and IntelliJ integrations for Spotless for Gradle | Pricing on github.com | |
| The Python part of a mixed-language repository | Not stated on official pages | Pricing on black.readthedocs.io | |
| C and C++ code in a shared repository | Standalone tool and editor integrations | Pricing on clang.llvm.org | |
| Shell scripts inside a polyglot repo | Many operating systems and package managers; Docker images | Pricing on github.com | |
| Java modules that follow Google Java Style | JDK or GraalVM native binary; IntelliJ and Eclipse plugins | Pricing on github.com |
Quick verdict by need
- Prettier if you need teams that want an opinionated formatter in editors and git hooks.
- dprint if you need monorepos that want one formatter CLI and one config.
- Spotless if you need gradle, Maven or sbt based repositories.
- Black if you need the Python part of a mixed-language repository.
- clang-format if you need c and C++ code in a shared repository.
- shfmt if you need shell scripts inside a polyglot repo.
Tool details

#1 · Prettier
Prettier
Teams that want an opinionated formatter in editors and git hooks

Prettier is an opinionated code formatter that integrates with most editors and acts as a fully automatic style guide. It aims to end ongoing debates over code style.
Documented strengths
- Opinionated, fully automatic style guide
- Runs in pre-commit scripts or githooks
- Formats on save, with editor key bindings
- Built-in support for Lightning Web Components (LWC)
- Can clean up an existing inconsistent codebase
Documented limits
Its official materials are framed mainly around JavaScript developers, and the facts we verified do not list a full language set. Teams with many non-web languages should check the vendor documentation for coverage.
- Who it is for
- Teams that want an opinionated formatter in editors and git hooks
- Platforms
- Most editors; online try-it option available
- Pricing
- See the vendor's own pricing page for current plans and costs. prettier.io
- Facts checked
- 21 November 2026
Why it is placed here: It opens the list because its documentation explicitly covers running as part of pre-commit scripts or githooks, and it can clean up an existing inconsistent codebase quickly.

#2 · dprint
dprint
Monorepos that want one formatter CLI and one config

dprint is a pluggable, configurable code formatting platform written in Rust. It aims to be a single formatting tool for every language in a repository.
Documented strengths
- Official plugins for TypeScript/JavaScript, JSON, Markdown, TOML, Dockerfile, SQL and Jupyter notebooks
- dprint check verifies code is already formatted
- Wrapper plugins for Prettier, Biome and Oxc, plus an Exec plugin for any other CLI formatter
- Plugins pinned and versioned in config, loaded from a URL or file path
- Incremental caching by default
Documented limits
Official plugins cover the languages listed above. Teams that need other languages should check the vendor documentation for community plugins or use the Exec plugin to wrap an existing formatter.
- Who it is for
- Monorepos that want one formatter CLI and one config
- Platforms
- Single static binary; install via shell script, PowerShell, npm, Homebrew or Cargo
- Pricing
- See the vendor's own pricing page for current plans and costs. dprint.dev
- Facts checked
- 21 November 2026
Why it is placed here: It sits second because it is designed around the polyglot case: one CLI, one dprint.json, and a dprint check command for CI.

#3 · Diffplug
Spotless
Gradle, Maven or sbt based repositories

Spotless formats many languages using Gradle, Maven, sbt or other build systems. A formatter is conceptually a function from unformatted to formatted string.
Documented strengths
- check and apply commands for Gradle and Maven
- Ratcheting from origin/main or another git ref
- Automatic idempotency and misconfigured-encoding safeguards
- Formatter steps including google-java-format, Palantir Java format and Prettier
- Fast incremental formatting and build-cache support on fresh checkout
Documented limits
It is documented around build-system integration, so repositories without Gradle, Maven, sbt or another supported tool should check the vendor documentation first. Support differs by formatter and build-system combination, as the project accepts partial support contributions.
- Who it is for
- Gradle, Maven or sbt based repositories
- Platforms
- Gradle, Maven, sbt and other build tools; VS Code and IntelliJ integrations for Spotless for Gradle
- Pricing
- See the vendor's own pricing page for current plans and costs. github.com
- Facts checked
- 22 November 2026
Why it is placed here: It comes third because it suits repositories already organized around a JVM-style build system, with check and apply commands that fit CI.

#4 · Python Software Foundation
Black
The Python part of a mixed-language repository

Black is an uncompromising Python code formatter. Using it means ceding control over hand-formatting in exchange for speed and determinism.
Documented strengths
- Produces the smallest diffs possible
- Checks that reformatted code still produces an equivalent AST
- GitHub Actions and version control integration
- Works with Jupyter Notebooks
- Can run as a server via blackd
Documented limits
Documented for Python only; teams with other languages need additional formatters. The --fast option skips the equivalent-AST safety check.
- Who it is for
- The Python part of a mixed-language repository
- Platforms
- Not stated on official pages
- Pricing
- See the vendor's own pricing page for current plans and costs. black.readthedocs.io
- Facts checked
- 21 November 2026
Why it is placed here: It is first among the single-language tools because it handles the Python portion of a mixed repository with documented version control and GitHub Actions integration.

#5 · LLVM Project
clang-format
C and C++ code in a shared repository

ClangFormat is a set of tools built on LibFormat that formats C, C++, Java, JavaScript, JSON, Objective-C, Protobuf and C# code.
Documented strengths
- .clang-format found in parent directories, with a fallback style
- Dry-run mode shows changes without applying them
- -i edits files in place
- Skips files listed in .clang-format-ignore
- Preset styles and line-range formatting
Documented limits
Documented for the languages listed above. Teams using other languages should pair it with another formatter and check the vendor documentation for pre-commit setup.
- Who it is for
- C and C++ code in a shared repository
- Platforms
- Standalone tool and editor integrations
- Pricing
- See the vendor's own pricing page for current plans and costs. clang.llvm.org
- Facts checked
- 21 November 2026
Why it is placed here: It follows because it covers C-family and several other languages through a .clang-format file that is discovered from parent directories, which suits a shared repository layout.

#6 · mvdan
shfmt
Shell scripts inside a polyglot repo

shfmt is a shell script formatter, part of the mvdan/sh project, which also provides a parser and interpreter for POSIX Shell, Bash, Zsh and mksh.
Documented strengths
- Documented default style
- Deliberately limited formatting options
- Supports POSIX Shell, Bash, Zsh and mksh syntax
- sh-checker GitHub Action uses shfmt
- Release tags published as Docker images
Documented limits
Formatting cannot be disabled for ranges of lines, so teams that need partial opt-outs should check the vendor documentation. It formats shell only.
- Who it is for
- Shell scripts inside a polyglot repo
- Platforms
- Many operating systems and package managers; Docker images
- Pricing
- See the vendor's own pricing page for current plans and costs. github.com
- Facts checked
- 21 November 2026
Why it is placed here: It earns a place for repositories with shell scripts, with a deliberately small set of options that supports team-wide consistency, and it has a CI action in sh-checker.

#7 · Google
google-java-format
Java modules that follow Google Java Style

google-java-format is a program from Google that reformats Java source code to comply with Google Java Style.
Documented strengths
- Maven plugin can deploy it as a pre-commit git hook
- GitHub Action formats Java files on push
- Script to reformat only the changed lines of a patch
- --style flag selects Google or AOSP style
- Column limit configurable, default 100
Documented limits
It deliberately offers almost no configurability, and it must run on a JDK at least as new as the Java language version being formatted. GraalVM-based native binaries are available as an alternative.
- Who it is for
- Java modules that follow Google Java Style
- Platforms
- JDK or GraalVM native binary; IntelliJ and Eclipse plugins
- Pricing
- See the vendor's own pricing page for current plans and costs. github.com
- Facts checked
- 21 November 2026
Why it is placed here: It sits last because it covers one language, but it has a documented Maven plugin that deploys it as a pre-commit git hook and a GitHub Action for formatting on push.
Sources
- Prettier: prettier.io, prettier.io/docs/why-prettier (21 Nov 2026)
- dprint: dprint.dev, dprint.dev/overview (21 Nov 2026)
- Spotless: github.com/diffplug/spotless, github.com/about, github.com/features (22 Nov 2026)
- Black: black.readthedocs.io/en/stable (21 Nov 2026)
- clang-format: clang.llvm.org/docs/ClangFormat.html (21 Nov 2026)
- shfmt: github.com/mvdan/sh, github.com/about, github.com/features (21 Nov 2026)
- google-java-format: github.com/google/google-java-format, github.com/about, github.com/features (21 Nov 2026)
Related guides
How we compiled this
We looked at three things: fit with the use case of enforcing one style across many languages in a shared repository, the capabilities each vendor documents (check modes, configuration files, ignore mechanisms, hook and CI integrations), and the deployment and platform information on the official pages. Every statement in this list comes from official vendor pages, each carrying a check date. Anything a vendor does not document is left out or flagged as not stated.
The order reflects editorial fit for this use case, explained in words in each entry: multi-language tools and tools that wire easily into a shared repo workflow come first, and single-language formatters follow. It does not say one tool is better overall, since a Python-only formatter and a multi-language platform solve different parts of the problem. The list is built from documentation rather than product trials, so check each vendor's documentation against your own language mix before adopting a tool.
Order used: Ordered by number of languages covered and ease of wiring into a shared repo workflow, broadest first.
Common questions
How do I run a code formatter in pre-commit hooks?
Prettier documents running as part of pre-commit scripts or githooks, and google-java-format has a Maven plugin that deploys it as a pre-commit git hook. For other tools, check the vendor documentation for hook setup.
Is there one formatter for every language in a repository?
dprint aims to be a single formatting tool for every language in a repository. Its official plugins cover TypeScript/JavaScript, JSON, Markdown, TOML, Dockerfile, SQL and Jupyter notebooks, and an Exec plugin can wrap other CLI formatters.
How can CI check formatting without changing files?
dprint check verifies that code is already formatted, Spotless provides check and apply commands for Gradle and Maven, and clang-format has a dry-run mode that shows what would change without applying it.
Can I format only changed code when adopting a formatter in an existing repo?
Spotless supports ratcheting from origin/main or another git ref, and google-java-format provides a script to reformat only the changed lines of a patch.
Which formatters work with build systems like Gradle or Maven?
Spotless works with Gradle, Maven, sbt and other build tools. google-java-format also has a Maven plugin for pre-commit use.
The editorial order is unpaid. A vendor can buy one labelled featured slot per guide, but it gets the same fact check as everyone else and cannot alter or remove a competitor's entry. Guidehurst is independent. Product names and logos belong to their respective owners.