Terraform Formatter
Paste Terraform/HCL code and get it cleanly indented and consistently formatted.
Paste your Terraform (HCL) code below - this tool re-indents blocks and normalizes spacing around the common patterns HCL uses.
For guaranteed byte-for-byte output matching HashiCorp's own tool, `terraform fmt` in your own environment remains the authoritative formatter.
What Does This Tool Do?
It re-indents nested HCL blocks (like resource, variable, and provider blocks) consistently and normalizes spacing around = assignments, similar in spirit to what terraform fmt does locally.
Why Use This Tool?
Useful for quickly cleaning up HCL pasted from elsewhere (a chat message, a ticket, an AI-generated snippet) into consistent formatting before you paste it into your own project.
How to Use It
- Paste your Terraform/HCL code.
- Click Format.
- Copy the cleanly formatted result.
Limitations
This handles common, well-formed HCL structure - severely malformed input (mismatched braces/quotes) is reported clearly rather than silently corrupted, since guessing at broken syntax could produce misleading output.