YAML to XML
Convert YAML into well-formed XML: keys become elements and lists become repeated elements, with special characters escaped correctly. Useful for feeding YAML config into XML-based systems. Runs in your browser.
Suggested tools
About YAML to XML
YAML to XML converts YAML data into well-formed XML. Keys become elements, lists become repeated elements, and characters such as & and < are escaped correctly, so the output can be loaded by any XML parser.
It is useful when a system only accepts XML — older APIs, SOAP services, some CI tools — but you prefer to write your data in YAML. Everything runs locally in your browser — the text you paste is never uploaded.
How to use YAML to XML
- Paste YAML or upload a .yaml file.
- Press Convert.
- Copy or download the XML.
Key features
- Keys become elements, lists become repeated elements
- Special characters escaped
- YAML syntax checked first, with line numbers
- Supports anchors and merge keys (<<)
Example
The list becomes repeated <items> elements.
invoice:
number: INV-2041
items:
- Pen
- Notebook
<invoice> <number>INV-2041</number> <items>Pen</items> <items>Notebook</items> </invoice>
When to use YAML to XML
- Feeding YAML configuration into systems that only accept XML.
- Generating XML test data from readable YAML.
- Converting between config formats during a migration.
Tips and common problems
- Use a single top-level key to name the root element.
- Prefix keys with @_ to create XML attributes.
- Keys with spaces or starting with a digit are renamed to valid XML names.
Frequently asked questions
Prefix a key with @_ (for example "@_id: 5") and it becomes an attribute of its parent element.
If your YAML has a single top-level key, that key becomes the root element.
No. Comments are not data, so they are not carried into the XML.