How to use it
- Choose Format YAML, YAML → JSON or JSON → YAML.
- Paste your YAML or JSON.
- Read the result, or the error with its exact line and column if the input is invalid.
- Choose 2 or 4 spaces and Sort keys if needed, then copy or download.
Catch YAML mistakes before they deploy
YAML runs a lot of infrastructure: Kubernetes manifests, Docker Compose, GitHub Actions and GitLab CI, Ansible, OpenAPI specs and app configs. It is readable but strict about indentation, and a single misplaced space can break a deployment or silently change the meaning of a file. The validator shows the exact line and column of the problem, and formatting makes indentation consistent.
Converting to JSON shows exactly how a program will read your YAML, which exposes surprises such as values you expected to be text turning into numbers or booleans. Converting JSON to YAML is handy when a tool gives you JSON but your config needs YAML.
Good to know
Formatting rewrites the file from its data, so comments are not kept, and anchors and aliases are expanded. Keep your original file and use the formatted version as a check, or copy back only the parts you need. This page uses js-yaml, the YAML parser used by many JavaScript tools.
Questions
- Why is my YAML invalid?
- Usually inconsistent indentation, a tab instead of spaces, or a colon in an unquoted value. The error shows the line and column.
- Are comments kept?
- No. Comments are not part of the data, so they are lost when the file is reformatted. Keep a copy of the original.
- Can it read multiple documents separated by ---?
- It formats a single document. Split multi-document files and format each part.
- Is what I paste sent to a server?
- No. The tool runs as JavaScript in your browser. Your text, files and keys stay on your device, so it is safe to use with internal data, tokens and customer records. It keeps working offline after the page has loaded once.