YAML Validator
Validate YAML syntax and pinpoint errors with clear line references.
Format and validate YAML with consistent indentation and optional key sorting.
YAML Formatter reformats YAML into a clean, consistently indented structure. It can also sort keys alphabetically and validates syntax at the same time. Useful for tidying up Docker Compose, GitHub Actions, Kubernetes, and other configuration files.
docker-compose.yml or GitHub Actions workflow file is syntactically valid: just run it through the formatter and any parse error will be surfaced immediately.&) and aliases (*) with the references already resolved: useful when you want to see the actual values in YAML that reuses shared config, without manually tracing the references.Input:
name: Torinoa Tools
version: "1.0.0"
features:
- free
- no-login
- browser-only
Formatted (2-space indent, no sorting):
name: Torinoa Tools
version: 1.0.0
features:
- free
- no-login
- browser-only
With the same input, switching the indent width to 4 spaces and turning on “Sort keys” produces:
features:
- free
- no-login
- browser-only
name: Torinoa Tools
version: 1.0.0
The keys are reordered alphabetically (features → name → version), and the array elements are indented with 4 spaces.
Input:
defaults: &defaults
adapter: postgres
timeout: 30
production:
<<: *defaults
database: prod_db
Formatted:
defaults:
adapter: postgres
timeout: 30
production:
adapter: postgres
timeout: 30
database: prod_db
The <<: *defaults reference is resolved, and the contents of defaults are inlined directly into production.
Input:
name: Torinoa Tools
version: 1.0.0
The indentation of version is invalid, so formatting produces this error:
YAML parse error: bad indentation of a mapping entry (2:10)
Check that the indentation depth is consistent throughout the file.
Yes. If you enter invalid YAML, a parse error message is displayed.
No. Comments are removed during the parse and re-dump process.
Anchors and aliases are expanded and inlined in the output.
No. All processing happens in your browser.
No. Line wrapping is disabled, so even long values are output on a single line. You don't need to worry about unexpected line breaks being inserted.
Turning on "Sort keys" alphabetically reorders the keys within each mapping (object), applied recursively to nested mappings as well. Leave it off to preserve the original key order.