YAML ↔ XML Converter
Convert YAML to XML or XML back to YAML, with attributes and type handling you control.
Processing: This tool runs entirely in your browser. Your input and any file you open stay on your device — nothing is uploaded to a server.
How to use the yaml ↔ xml converter
- Choose a direction, or paste and swap.
- Set how attributes and types should be handled.
- Convert, then copy or download the result.
About this tool
YAML and XML describe overlapping but different shapes, so a conversion between them has to make choices. Making those choices visible is more useful than hiding them behind a button, because the wrong one produces a document that parses and means something else.
A YAML list becomes a repeated element rather than an invented `<item>` wrapper, since repetition is how XML expresses a sequence. That has an unavoidable consequence in the other direction: an element appearing twice reads as a list, while the same element appearing once reads as a single value — so a document with one order and a document with two produce structurally different results. Only a schema resolves that, and there is not one here.
XML attributes have no YAML equivalent at all. They are kept with an `@` prefix when you want them and dropped when you do not, and the choice is yours because both answers are right for different documents.
Type coercion is offered rather than assumed. XML has no types — everything is text — so turning `12` into a number is a guess. It is usually the right guess, and it is the wrong one for an identifier like `007`, which is why the conversion only applies when the number round-trips to exactly the same string.
The XML is parsed here rather than by the browser, so a malformed document gives the same error message everywhere and names the position of the fault, instead of each browser recovering differently.
Common uses
- Moving configuration between systems that expect different formats.
- Reading an XML API response as YAML.
- Producing XML from a YAML definition file.
Frequently asked questions
- How are YAML lists represented in XML?
- As a repeated element, which is how XML expresses a sequence. Wrapping each entry in an <item> element would add a level the data does not have.
- What happens to XML attributes?
- They are kept with an @ prefix or dropped, as you choose. YAML has no attribute concept, so either answer loses something and the right one depends on the document.
- Why is 007 not converted to a number?
- Because the conversion only applies when the number round-trips to the same text. 007 would become 7, which is a different identifier.
Related tools
JSON ↔ YAML Converter
Convert JSON to YAML or YAML back to JSON, in either direction, with indent control.
JSON ↔ XML Converter
Convert JSON to XML or XML back to JSON, in either direction.
XML Formatter & Minifier
Indent XML to reveal its structure, or minify it back to a single line.
CSV to XML Converter
Convert CSV rows into XML records, with names and values escaped correctly.