Zig fmt
Zig fmt is the source formatter included with the Zig toolchain.
What Zig fmt is
Zig fmt is the source formatter included with the Zig toolchain. It parses Zig code using support from the standard library and formats it to a canonical style. The `--check` option identifies files that do not conform, prints their names to standard output, and exits with an error if any are found; it does not change those files. The Zig build system can run the formatter across a codebase or a selected subset. Zig fmt can also make invalid source encodings valid, including by removing byte order marks and carriage returns.
Zig fmt is for Zig code and is available on Windows, macOS, and Linux through Zig releases. The toolchain is open source and free, listed as free. The release notes cite integrations for Vim and VSCode, and Zig can also be installed from a package manager. Release files are signed with minisign. The language reference is available as an offline-capable HTML document.
Good
- Formats Zig code to a canonical style.
- Check mode reports issues without changing files.
- Can run on a codebase or subset.
- Available on Windows, macOS, and Linux.
- Can clean up invalid source encodings.
Watch out
- Formats Zig code only.
- No free trial is listed.
Who it suits
Zig developers who want a consistent format for source files can use Zig fmt, whether running it on a whole codebase or a subset. Its check mode also suits workflows that need to identify nonconforming files without modifying them.
Verdict
Zig fmt provides formatting, non-modifying checks, and encoding cleanup for Zig code. It is free as part of the Zig toolchain and supports the listed desktop platforms.
Plans and prices
From Zig fmt's own pricing page, checked 8 Oct 2026.
| Plan | Price | What it gives you |
|---|---|---|
| Zig fmt (included with Zig) | Free | Zig source formatting · available as part of the Zig toolchain |
The facts
Each one read from Zig fmt's own pages, with the date it was checked.
What it does
- Automation
- The download page recommends community mirrors for automated downloads to avoid downtime and help reduce bandwidth costs.checked 8 Oct 2026
- Build system
- The Zig build system can run `zig fmt` on a codebase or a subset of it.checked 8 Oct 2026
- C and C++ projects
- The Zig home page says developers can use Zig as a zero-dependency C and C++ compiler with cross-compilation, and add Zig compilation units to C/C++ projects.checked 8 Oct 2026
- Check mode
- The `--check` flag lists nonconforming files on stdout and exits with an error if the list is nonempty, without modifying file contents.checked 8 Oct 2026
- Distribution
- Zig releases are available for Windows, macOS, and Linux, and the download page says release files are signed with minisign.checked 8 Oct 2026
- Editor integrations
- The release notes cite integrations for Vim and VSCode.checked 8 Oct 2026
- Encoding cleanup
- `zig fmt` can convert invalid source encodings to valid ones, including by stripping byte order marks and carriage returns.checked 8 Oct 2026
- How it works
- The formatter uses Zig code parsing support from the standard library.checked 8 Oct 2026
- How to run
- The Zig build system can run `zig fmt` on a codebase or a subset of it.checked 8 Oct 2026
- Maintainer organization
- The Zig Software Foundation is described as a 501(c)(3) nonprofit corporation founded in 2020 to support Zig development.checked 8 Oct 2026
- Offline documentation
- The language reference states that its HTML document depends on no external files and can be used offline.checked 8 Oct 2026
- Package managers
- The download page says Zig can also be installed from a package manager.checked 8 Oct 2026
- Part of Zig
- The download page provides Zig distributions that include the language reference and standard library documentation.checked 8 Oct 2026
- Purpose
- `zig fmt` formats Zig code to a canonical style.checked 8 Oct 2026
- Release channel
- The download page lists a master build dated 2026-10-08 and links to its language reference and standard library documentation.checked 8 Oct 2026
- Signed files
- The download page says files are signed with minisign and provides a public key.checked 8 Oct 2026
- Source encoding
- The documentation says `zig fmt` can convert invalid source encodings to valid ones, including by stripping byte order marks and carriage returns.checked 8 Oct 2026
- Support and funding
- The foundation asks for recurring donations to fund ongoing software development, maintenance, and support.checked 8 Oct 2026
- Who it is for
- Zig describes itself as a general-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.checked 8 Oct 2026
Where it runs
- Linux support
- The download page lists Zig releases for Linux x86_64, aarch64, arm, riscv64, powerpc64le, x86, loongarch64, and s390x.checked 8 Oct 2026
- macOS support
- The download page lists Zig releases for macOS x86_64 and aarch64.checked 8 Oct 2026
- Windows support
- The download page lists Zig releases for Windows x86_64, aarch64, and x86.checked 8 Oct 2026
Alternatives to Zig fmt
- 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
