Caddy(8) Caddy(8)

# [NAME](#NAME)

caddy-fmt - Formats a Caddyfile

# [SYNOPSIS](#SYNOPSIS)

**caddy fmt \[--overwrite] \[--diff] \[] \[flags]**

# [DESCRIPTION](#DESCRIPTION)

Formats the Caddyfile by adding proper indentation and spaces to improve human readability. It prints the result to stdout.

If --overwrite is specified, the output will be written to the config file directly instead of printing it.

If --diff is specified, the output will be compared against the input, and lines will be prefixed with '-' and '+' where they differ. Note that unchanged lines are prefixed with two spaces for alignment, and that this is not a valid patch format.

If you wish to use stdin instead of a regular file, use - as the path. When reading from stdin, the --overwrite flag has no effect: the result is always printed to stdout.

# [OPTIONS](#OPTIONS)

**-c**, **--config**="" Configuration file

**-d**, **--diff**\[=false] Print the differences between the input file and the formatted output

**-h**, **--help**\[=false] help for fmt

**-w**, **--overwrite**\[=false] Overwrite the input file with the results

# [SEE ALSO](#SEE_ALSO)

[**caddy(8)**](/man/enterprise-packages/caddy/caddy.8)

# [HISTORY](#HISTORY)

5-Oct-2026 Auto generated by spf13/cobra

Oct 2026 Auto generated by spf13/cobra

---

Document: caddy-fmt(8) from caddy 2.11.7-r0 (Chainguard OS)
Source: https://github.com/caddyserver/caddy
