How to use the YAML Formatter & Validator
- Paste your YAML or open a .yml file.
- Choose the indentation.
- Fix any error shown, then copy or download the formatted YAML.
What does this tool do?
YAML is whitespace-sensitive, so one misplaced space can break a CI pipeline or Kubernetes manifest. The validator points to the line with the problem.
Formatting normalises indentation and quoting while keeping your comments. Sorting keys alphabetically is optional — it removes comments because the document is rebuilt. Everything runs in your browser; nothing you paste is uploaded.
Why use it?
- Errors with line numbers.
- Keeps comments.
- Multi-document files supported.
Use cases
- Fix CI pipelines (GitHub Actions, GitLab CI).
- Tidy Kubernetes, Docker Compose and Helm files.
- Validate config files before committing them.
A classic YAML trap
In older YAML 1.1 parsers, country: NO can be read as false, and version: 1.10 as the number 1.1. Quote values like "NO" and "1.10" to keep them as text.
Common mistakes
- Using tabs for indentation — YAML only allows spaces.
- Mixing two- and four-space indentation in one file.
- Sorting keys in files whose order or comments matter.
Privacy
The calculation happens instantly in your browser. The numbers you enter are not sent to our servers or saved. There's no account to create and nothing to install.
Frequently asked questions
Are comments kept?
Yes, when formatting. Sorting keys removes them because the document is rebuilt.
Two or four spaces?
Two is the most common for YAML; just be consistent.
Is YAML a superset of JSON?
YAML 1.2 is, so valid JSON is also valid YAML.
Content last updated . See how M2Toolkit works.