
Scalafmt
Scalafmt is a free, open-source formatter that helps teams apply consistent formatting to Scala code.
What Scalafmt is
Scalafmt is a free, open-source formatter that helps teams apply consistent formatting to Scala code. It formats Scala 2, Scala 3, sbt files, and Scala scripts, with one selected dialect for each file. Rules are configured in a plain text `.scalafmt.conf` file using HOCON syntax. Since version 3.1.0, the configuration must explicitly specify the Scalafmt version and `runner.dialect`.
Scalafmt can run from an editor, a build tool, or a terminal. Documented editor integrations include IntelliJ, VS Code, Vim, NeoVim, Emacs, Sublime Text, and Eclipse; Metals supports editor formatting requests. It integrates with sbt and documents integrations for Maven, Gradle, and Mill. Command-line check and test modes report misformatted code without changing files. Other listed capabilities include ignoring files, formatting changed lines, and a library API. IntelliJ range formatting uses IntelliJ’s own formatter by default because Scalafmt is designed mainly for whole files and selected ranges may produce undesirable results. The project identifies its license as Apache-2.0.
Good
- Supports Scala 2, Scala 3, and sbt dialects
- Runs from editors, build tools, or terminal
- Check and test modes avoid writing changes
- Offers editor and build-tool integrations
- Apache-2.0 license
Watch out
- Configuration must specify version and runner.dialect
- IntelliJ range formatting defaults to IntelliJ’s formatter
- Selected-range formatting may produce undesirable results
Who it suits
Scalafmt suits Scala developers and teams seeking consistent formatting through editors, build tools, or the command line. It is also relevant for projects using sbt files or Scala scripts.
Verdict
Scalafmt provides broad Scala formatting support and several ways to fit it into development workflows. Teams should account for its explicit configuration requirements and IntelliJ’s range-formatting behavior.
Plans and prices
From Scalafmt's own pricing page, checked 7 Oct 2026.
| Plan | Price | What it gives you |
|---|---|---|
| Free | Free | Code formatter for Scala |
The facts
Each one read from Scalafmt's own pages, with the date it was checked.
What it does
- Build integrations
- Scalafmt integrates with sbt and has documented integrations for Maven, Gradle, and Mill.checked 7 Oct 2026
- Configuration
- Formatting options are set in a plain text .scalafmt.conf file using HOCON syntax.checked 7 Oct 2026
- Editor integrations
- The documentation describes use with IntelliJ, VS Code, Vim, NeoVim, Emacs, Sublime Text, and Eclipse, with Metals supporting formatting requests from editors.checked 7 Oct 2026
- File support
- Scalafmt can format Scala files as well as .sbt and .sc files.checked 7 Oct 2026
- Formatting checks
- The CLI offers check and test modes that report misformatted code without writing changes.checked 7 Oct 2026
- How to run it
- Scalafmt can run from an editor, build tool, or terminal.checked 7 Oct 2026
- IntelliJ limitation
- IntelliJ range formatting uses its own formatter by default because Scalafmt is primarily designed to format entire text files and selected ranges may produce undesirable results.checked 7 Oct 2026
- License
- The GitHub repository identifies the project license as Apache-2.0.checked 7 Oct 2026
- Purpose
- Scalafmt is a code formatter for Scala that formats code consistently across a team.checked 7 Oct 2026
- Scala dialects
- The formatter supports Scala 2, Scala 3, and sbt-specific dialects, with one dialect selected for each file.checked 7 Oct 2026
- Security
- The official Scalafmt pages opened for this research do not state security certifications or compliance claims.checked 7 Oct 2026
- Support
- The project site links to a community Discord and GitHub, and the CLI help directs bug reports to GitHub issues.checked 7 Oct 2026
- Version requirement
- Since version 3.1.0, the version and runner.dialect settings must be specified explicitly in configuration.checked 7 Oct 2026
Alternatives to Scalafmt
- 1

Prettier
Free planOpen sourceWebAPIExtensionLinux7.5Free plan - 2
Avidemux
Free planOpen sourceWebLinuxmacOSWindows7.3Free plan - 3
Fourmolu
Free planWebLinuxWindows6.7Free plan - 4
rustfmt
Free planLinuxmacOSWindows6.6Free plan - 5
Black
Free planLinuxmacOSSelf-hostedWindows6.5Free plan - 6

Ruff
Free planWebLinuxmacOSSelf-hosted6.5Free plan
