Kotlin Formatter – tool for formatting Kotlin source code

Kotlin Formatter is a tool for formatting Kotlin source code.

It is built around ktfmt and provides a unified formatting workflow across the command line, Git hooks, Gradle, and IntelliJ IDEA.

Kotlin Formatter is designed for teams that want an automated and consistent Kotlin formatting setup across different developer workflows. Its command-line utility can be used directly, wired into Git hooks, or run from build tooling. The IntelliJ plugin extends the same formatter into the IDE, helping keep formatting behaviour consistent between local editing, commits, and automated checks.

The Gradle plugin supplies formatting and checking tasks, while the Git hook scripts help catch formatting drift early in the development process. The experimental daemon mode is useful for repeated formatting operations where avoiding JVM startup time can make the formatter feel more responsive.

This is free and open source software.

Key Features

  • Formats Kotlin source files from the command line
  • Supports files, directories, and standard input
  • Wrapper around ktfmt for consistent Kotlin formatting
  • Configurable maximum line width
  • Dry-run mode to preview formatting changes
  • Option to return a non-zero exit status when files need formatting
  • Pre-commit support for formatting staged files before committing
  • Pre-push support for checking committed files before pushing
  • Experimental daemon mode to reduce repeated JVM startup overhead
  • IntelliJ IDEA plugin with manual formatting and format-on-save support
  • Gradle plugin with tasks to apply and check formatting
  • Can be installed using Hermit, GitHub Releases, Maven Central, or a standalone JAR

Website: github.com/block/kotlin-formatter
Support:
Developer: Block
License: Apache License 2.0

Kotlin Formatter is written in Kotlin. Learn Kotlin with our recommended free books and free tutorials.


Related Software

Kotlin Code Formatters
ktlintKotlin linter with built-in formatter
SpotlessKeeps codebases pristine with automated formatting checks
ktfmtPretty-prints (formats) Kotlin code
ktlint-gradleRuns ktlint from Gradle to enforce Kotlin style rules
Kotlinter GradlePlugin for linting and formatting
ktlint-gradle-pluginBrings Kotlin linting and formatting checks into Gradle projects
ktfmt-gradleAdds ktfmt formatting to Gradle builds with minimal fuss.
Kotlin FormatterFormats Kotlin source with a simple, consistent command-line tool

Read our verdict in the software roundup.


Best Free and Open Source Software Explore our carefully curated directory of recommended free and open source software, covering every major software category.

The directory forms part of our extensive collection of articles for Linux enthusiasts. It includes hundreds of detailed reviews, together with free and open source alternatives to proprietary software from companies such as Google, Microsoft, Apple, Adobe, IBM, Cisco, Oracle, and Autodesk.

LinuxLinks also covers interesting projects worth exploring, Linux-compatible hardware, free programming books and tutorials, and much more.

Know a useful free and open source Linux application that we haven’t covered? Tell us about it using our submission form.
Subscribe

Please read our Comment Policy before commenting.

Notify of
guest
0 Comments
Oldest
Newest Most Voted