Format and beautify Terraform HCL code instantly. Aligns equals signs, fixes indentation, and normalizes whitespace - same output as terraform fmt. No install needed.
The HCL Formatter applies the same formatting rules as the <code>terraform fmt</code> command without requiring Terraform to be installed. It normalizes indentation to two spaces, aligns the equals signs within blocks of consecutive assignments, removes trailing whitespace, and ensures consistent spacing around operators. The result is idiomatic HCL that passes code review and diff tools cleanly.
Paste your Terraform or OpenTofu HCL into the left pane. The formatted output appears in the right pane instantly. Click Copy to copy the result to your clipboard. The formatter handles nested blocks, heredoc strings, and multiline values without modifying their content.
Equals signs are aligned within contiguous groups of single-line assignments. A blank line, a block opener, or a heredoc boundary flushes the alignment group. Meta-argument ordering (source before other arguments) is not changed - the formatter only adjusts whitespace, never reorders lines.