YAML Formatter & Validator Online
Format and validate YAML with consistent 2-space indentation, key alignment, and comment preservation.
How to Use
- 1
Paste YAML
Paste your YAML configuration file content.
- 2
Format
Click Format to normalize indentation to 2 spaces.
- 3
Copy
Copy the clean, properly formatted YAML.
FAQ
How do comments work in YAML?
YAML comments start with # and continue to the end of the line. They can appear on their own line or after a value. This formatter preserves existing comments during reformatting.
What indentation does YAML use?
YAML uses spaces (never tabs) for indentation. This formatter normalizes to 2 spaces per level, which is the standard for Docker Compose, Kubernetes manifests, and GitHub Actions workflows.
Why is my YAML invalid?
Common YAML errors include: using tabs instead of spaces, incorrect indentation levels, unquoted strings with special characters (: { } [ ]), and duplicate keys. This tool highlights the exact error location.