YAML Indentation Checker
YAML uses indentation as structure, so a spacing mistake can change the meaning of a deployment file, CI workflow, Docker Compose document or Kubernetes manifest. Formalint helps clean indentation and flags common YAML structure issues before a config file reaches production.
Open the YAML Formatter and Indentation Checker to clean a YAML snippet now.
Good YAML Indentation
Use spaces instead of tabs, keep sibling keys aligned, and indent child keys consistently under their parent. Two spaces is common, but consistency matters more than the exact width.
service:
name: api
ports:
- 8080
- 8443
Why YAML Indentation Breaks Builds
YAML files are common in GitHub Actions workflows, Kubernetes manifests, Docker Compose services and application configuration. In those places, indentation is not cosmetic. Moving a key two spaces left can move it to a different parent object, and moving a list item under the wrong key can change what a deployment or pipeline actually runs.
This is why YAML errors often feel unrelated to the line you just edited. The parser may complain about a later block because the parent block above it ended earlier than you expected. A quick indentation check helps you review structure before committing a config file.
Common YAML Mistakes
Watch for tabs mixed with spaces, list items aligned under the wrong key, duplicate keys in the same object and unquoted values such as yes, no, on or off when they should remain strings.
YAML Review Checklist
Before using a YAML file, scan sibling keys for the same indentation depth, confirm list items belong under the intended parent, remove tab characters and quote values that should stay as strings. Be especially careful with environment variables, version numbers, ports, feature flags and values copied from documentation.
Frequently Asked YAML Questions
Should YAML use two spaces or four spaces? Both can work, but two spaces is common in config files. The important part is consistency inside the same file.
Can a formatter know every YAML schema? No. A formatter can clean spacing and catch common structure problems, but Kubernetes, GitHub Actions and app-specific config files still have their own schema rules.
Related Formalint Pages
Use YAML Formatter for cleanup, JSON Schema Generator when validating JSON payloads, and Python Formatter for another indentation-sensitive language.