shfmt
shfmt: A configurable open-source formatter for shell scripting teams and automated workflows. Ranked #12 of 34 in Code Formatting Tools by our editors (6.1/10); pricing: Open source; best for shell scripting teams.
At a glance
- Editor score6.1 / 10
- PricingOpen source
- Best forShell scripting teams
- Paid fromNone
- Supported languagesPOSIX Shell, Bash, Zsh, mksh, and Bats
- Facts checked21 Sep 2026

Where it wins
- Supports POSIX Shell, Bash, Zsh, mksh, and Bats
- Formats files, directories, standard input, and recursive shell files
- Works with EditorConfig, ignore rules, editors, CI, and pre-commit
Where it doesn't
- Focused on shell dialects rather than broader programming languages
- Command-line workflows may not suit teams seeking a visual formatter
- Configuration covers shell layout options but requires project decisions
Our verdict on shfmt
shfmt is an open-source command-line formatter for developers maintaining shell programs locally or in automated workflows. It supports POSIX Shell, Bash, Zsh, mksh, and Bats, and runs on Linux, Windows, and macOS. Teams can format files, directories, or standard input, while recursive discovery helps apply formatting across shell files. Its scope makes it a strong fit for shell scripting teams that want a focused formatter with configurable output rather than a general-purpose code-formatting platform.
Formatting control is a central strength. shfmt supports configurable indentation, case indentation, binary-operator placement, and redirect spacing, with options read from EditorConfig. It can list changed files, write formatted files, or print diffs, giving teams several ways to review or enforce changes. Ignore rules for selected paths, plus simplification, minification, and shell syntax validation, extend the tool beyond basic layout changes. Typed JSON syntax-tree input and output also support workflows that need structured parser and formatter data.
Its ecosystem fit is broad for a command-line tool: integrations include BashSupport-Pro, the IntelliJ shell script plugin, micro, NeoVim, VS Code, Emacs, Trunk, Docker, and pre-commit. The project also exposes parser and formatter functionality through Go packages, which can support programmatic workflows. shfmt is a clear choice for teams standardizing shell code across editors and automation. Teams working primarily outside shell scripting, or looking for a broader multi-language formatting system, should choose a tool with wider language coverage.
shfmt pricing
shfmt fact sheet
| Free plan | Not verified |
|---|---|
| Paid from | None |
| Supported languages | POSIX Shell, Bash, Zsh, mksh, and Bats |
| Supported platforms | Linux, Windows, macOS |
| Editor integration | Yes |
| Ignore files | Yes |
| Changed-lines formatting | Not verified |
| Library API | Yes |
| License model | Open_source |
| Deployment | Desktop |
| Platforms | Linux, Windows, macOS |
| Support | Community, Docs |
| Built for | Solo, Small business, Mid-market, Enterprise (editorial estimate) |
| Integrations | 9 integrations: BashSupport-Pro, IntelliJ shell script plugin, micro, NeoVim, VS Code, Emacs … |
| Pricing | Open source |
| Website | github.com |
| Facts checked | 21 Sep 2026 |
shfmt integrations
shfmt lists 9 integrations on its own site.
- BashSupport-Pro
- IntelliJ shell script plugin
- micro
- NeoVim
- VS Code
- Emacs
- Trunk
- Docker
- pre-commit
Alternatives to shfmt
- dprintA broad, editor-friendly formatter for multilingual repositories and changed-file workflows.9.0
- PrettierA broad, open-source formatter for web-language teams across editors and workflows.8.2
- SpotlessA build-focused formatter for JVM projects that need broad language coverage and automation.7.7
Used shfmt? Be the first to review it
The editor score above is our own research. What this page doesn't have yet is a reader's view — what you used shfmt for, what worked and what didn't. No stars are seeded and no review is paid for; an editor reads every one before it appears.
Write a reviewTwo minutes · verified accounts only · read by an editor before it appears
Featured on iTechGuides
shfmt is listed in our Code Formatting Tools directory. Add the badge to your site — it links back to this page.
<a href="https://www.itechguides.com/products/shfmt/"><img src="https://www.itechguides.com/best/badge/shfmt.svg" alt="Featured on iTechGuides" width="230" height="46"></a>
Reviewed by iTechGuides Editors · Editorial team · Updated Sep 2026
Advertiser disclosure: iTechGuides is reader-supported. We may earn a commission when you click some links. It never changes a score or a verdict. How we rank.
Last updated · How we research and update
