Terraform Formatter

Format Terraform HCL configuration files with proper indentation and alignment

  1. Home
  2. /
  3. Terraform Formatter

Formatted Output

Paste Terraform HCL and click Format

Lines

0

Blocks

0

Changed

-

What Is Terraform HCL Formatting?

Terraform uses HashiCorp Configuration Language (HCL) to define infrastructure as code. HCL files contain blocks for resources, variables, outputs, data sources, providers, and modules. Proper formatting is essential for readability, code review, and team collaboration. This tool formats Terraform HCL configuration by applying consistent indentation, aligning assignment operators, organizing block structure, and normalizing whitespace. It performs similar functions to the built-in terraform fmt command but works entirely in the browser, making it convenient for quick formatting without installing Terraform. Developers use it to clean up messy configurations, enforce team coding standards, and prepare code for version control commits.

How to Use This Tool

  1. Paste your HCL code — Enter or paste Terraform configuration into the input area.
  2. Click Format — The tool applies consistent indentation and alignment to the entire configuration.
  3. Review the output — Formatted code is displayed in the output panel with a summary of lines, blocks, and changes.
  4. Copy the result — Click Copy to copy the formatted HCL to your clipboard.
  5. Use examples — Click the example buttons (Resource, Variables, Module, Messy) to see before-and-after formatting.

Frequently Asked Questions

Is my data sent to a server?

No. All processing is performed locally in your browser. Your Terraform configuration never leaves your device.

How is this different from terraform fmt?

This tool provides similar basic formatting to terraform fmt but runs entirely in the browser. For best results, always use terraform fmt in your CI/CD pipeline.

What formatting rules are applied?

The tool applies consistent 2-space indentation, aligns equals signs in block arguments, separates blocks with blank lines, and normalizes whitespace.

Can I format partial configurations?

Yes. You can paste any HCL snippet including individual resource blocks, variable definitions, or output blocks.

Is this tool free to use?

Yes. This tool is completely free with no usage limits or registration required.

Last updated: 9 Jul 2026