About YAML Formatter & Validator
A YAML file edited by several people tends to drift: two spaces here, four there, a list indented under its key in one place and not in the next. Paste it here to check that it parses, with the line and column of the first error if it does not, and get it back with one consistent indentation.
The formatter keeps what you chose to write: quoted strings stay quoted, flow lists like [a, b] stay on one line, block text keeps its | or >, and anchors keep their names. Switch the output to JSON when you need the same data for a script.
How it works
- The input is parsed as YAML 1.2 with the core schema. JSON is valid YAML, so either can be pasted without choosing first.
- Converting to JSON expands anchors and aliases in place and applies << merge keys. A file with several documents separated by --- becomes a JSON array with one item per document.
- Converting to YAML writes plain block style with quotes only where a value would otherwise change meaning, such as the string "yes" or "1.0". Choose "Keep original style" to keep the quotes, flow lists, block text and anchors you wrote, re-indented.
- Aliases are counted before anything is expanded, so a file built to expand into billions of values, or an anchor that refers to itself, is refused instead of freezing the page.
Questions
Will it change my values?
No. With the original style kept, each value is written with the same quoting and the same digits it had, so a version like 1.10 or a long id is untouched. Only indentation and spacing change.
Does it keep comments?
No. The YAML is rebuilt from its structure, and comments are not part of it, so they are removed. The result warns you when the input looked as if it had comments; keep a copy if you need them.
Can it fix my YAML?
It reports the first syntax error with its line and column but does not guess a fix, since a wrong guess about indentation would change what the file means.
Everything you enter here is processed in this browser tab. Nothing is uploaded, logged or shared. How privacy works here.