Skip to content
SPECIFICTION
Get listed

Scalafmt

scalameta.org

Free plan WindowsmacOSLinuxSelf-hosted
Visit scalameta.org
Spec score 7.6 #22 of 34 in Code Formatting Tools

What it is

Scalafmt is a free Scala code formatter for keeping formatting consistent across a team. It handles Scala 2, Scala 3, sbt files and Scala scripts, with one dialect selected for each file. Formatting options are stored in a plain-text .scalafmt.conf file using HOCON syntax. Since version 3.1.0, the configuration must explicitly specify both the version and runner.dialect. Scalafmt can run from an editor, build tool or terminal. Documented editor integrations include IntelliJ, VS Code, Vim, NeoVim, Emacs, Sublime Text and Eclipse; Metals supports formatting requests from editors. It integrates with sbt and documents integrations for Maven, Gradle and Mill. Command-line check and test modes report misformatted code without writing changes. It also supports ignoring files, changed-lines formatting and a library API. IntelliJ range formatting uses IntelliJ’s own formatter by default: Scalafmt is designed primarily for whole files, and selected ranges may produce undesirable results. The project license is Apache-2.0.

Spec sheet

Purpose
Scalafmt is a code formatter for Scala that formats code consistently across a team.Read 7 Oct 2026 · scalameta.org
Security
The official Scalafmt pages opened for this research do not state security certifications or compliance claims.Read 7 Oct 2026 · scalameta.org
Support
The project site links to a community Discord and GitHub, and the CLI help directs bug reports to GitHub issues.Read 7 Oct 2026 · scalameta.org
License
The GitHub repository identifies the project license as Apache-2.0.Read 7 Oct 2026 · github.com
Build integrations
Scalafmt integrates with sbt and has documented integrations for Maven, Gradle, and Mill.Read 7 Oct 2026 · scalameta.org
Configuration
Formatting options are set in a plain text .scalafmt.conf file using HOCON syntax.Read 7 Oct 2026 · scalameta.org
Editor integrations
The documentation describes use with IntelliJ, VS Code, Vim, NeoVim, Emacs, Sublime Text, and Eclipse, with Metals supporting formatting requests from editors.Read 7 Oct 2026 · scalameta.org
File support
Scalafmt can format Scala files as well as .sbt and .sc files.Read 7 Oct 2026 · scalameta.org
Formatting checks
The CLI offers check and test modes that report misformatted code without writing changes.Read 7 Oct 2026 · scalameta.org
How to run it
Scalafmt can run from an editor, build tool, or terminal.Read 7 Oct 2026 · scalameta.org
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.Read 7 Oct 2026 · scalameta.org
Scala dialects
The formatter supports Scala 2, Scala 3, and sbt-specific dialects, with one dialect selected for each file.Read 7 Oct 2026 · scalameta.org
Version requirement
Since version 3.1.0, the version and runner.dialect settings must be specified explicitly in configuration.Read 7 Oct 2026 · scalameta.org

Plans and prices

Free Free Code formatter for Scala Read 7 Oct 2026 · scalameta.org

Every Scalafmt plan and price →

Strong points and limits

Strong points

  • Free and open-source under Apache-2.0.
  • Supports Scala 2, Scala 3 and sbt dialects.
  • Runs from editors, build tools and terminal.
  • Check and test modes avoid writing changes.
  • Supports changed-lines formatting and ignore files.

Limits

  • Version and runner.dialect must be explicit since 3.1.0.
  • IntelliJ range formatting defaults to IntelliJ’s formatter.
  • Selected-range formatting may produce undesirable results.

Who it suits

Scalafmt suits Scala teams that want consistent formatting across editors, build tools or the command line. It is also relevant to developers who need check-only formatting modes or a library API.

Verdict

Scalafmt offers broad editor and build-tool integration alongside configuration-based formatting and non-writing checks. Teams using IntelliJ should note its whole-file focus when considering range formatting.

Where Specifiction places it

Alternatives to ScalafmtAll alternatives →