XML to YAML converter
Convert XML to YAML that is easy to read. Attributes become "@_" keys and element text "#text", so nothing is lost.
What you get
- Convert XML to YAML online that is easy to read, with attributes as "@_" keys and repeated elements as lists.
- Checked twice: the XML step is proven by turning the data back into the same XML, and the YAML is parsed back and compared.
- Values like 007 or 20-digit IDs stay text, so nothing changes on the way.
- Private and free: everything runs in your browser, nothing is uploaded, and there is no sign-up.
How each result is checked
- Step 1: Your XML is checked for well-formedness first; errors show the line number.
- Step 1: The JSON is turned back into XML and parsed again, and every element and attribute must match the original.
- Step 1: Every word of text and every attribute value is also read from your XML independently, with its own reader, and must be in the JSON, so text cannot be dropped or left undecoded.
- Step 2: Your input is parsed with a strict, standards-compliant parser.
- Step 2: The YAML output is parsed back with an independent YAML parser.
- Step 2: The parsed-back data is compared with your original, value by value. Any difference is reported with its exact path.
What can't convert exactly
- Number detection only converts values whose text stays identical, so 007, 1.50, 1e3, +1 and 20-digit IDs stay text.
- Comments are not carried over, and CDATA becomes plain text.
- Character references such as A or 😀 are decoded. HTML names such as are not part of XML; they are kept as text, and the result says so.
- In elements that mix text with child elements (<p>a <b>x</b> c</p>), JSON cannot keep the order of text and children: the text pieces are joined with a space into "#text", and the result names the element.
- Namespaces are kept: prefixed names such as soap:Body stay as they are, and xmlns declarations become "@_xmlns" keys.
- Integers larger than 9,007,199,254,740,991 can lose precision when any JavaScript tool reads JSON. You get a warning when your input has one.
- Output follows YAML 1.2. Strings that YAML 1.1 readers (PyYAML, Ruby and other older libraries) would read as booleans, numbers or dates, such as yes, no, on, off, 1_000 or 2024-01-01, are quoted, so every YAML reader keeps them as strings.
- Numbers are written by value: 1.0 becomes 1 and 1e3 becomes 1000. The result names any number whose written form changes, because some readers (Python, for example) treat 1 and 1.0 differently.
Questions
How is a two-step conversion checked?
Your input is converted to JSON first, then to the target format. Each step has its own independent check, and both must pass. The checks of both steps are listed under every result.
Is my data uploaded?
No. Everything runs in your browser, in a background worker. Nothing is sent to a server.
How do I convert XML to YAML online?
Paste your XML or open a file on the left (or click Example). The YAML appears on the right as you type, already checked. Copy it, or download it as a file. Nothing is uploaded.
Can the YAML output be wrong?
Every result is checked before it is shown (the checks are listed on this page). If a check fails, the page says "Review needed" and why, instead of presenting the output as correct, and anything that cannot convert exactly is named in the notes.