YAML to XML Converter

YAML to XML Converter turns indentation-based YAML into well-formed XML. Mappings become nested elements, sequences become repeated tags, and keys prefixed with @ become attributes — producing XML that legacy systems and XML schemas can consume.

It runs locally in your browser with no dependencies. Paste your YAML and the XML is generated as you type, fully escaped and ready to use.

XML to YAML
YAML input0 chars
XML output
The result appears here as you type.

How to use YAML to XML Converter

  1. 1

    Paste your YAML

    Use block mappings, sequences and scalars; a single top-level key becomes the root element.

  2. 2

    Get the XML

    Mappings nest into elements and lists expand into repeated tags, live as you type.

  3. 3

    Copy or download

    Copy the XML or download a .xml file for your application.

How YAML maps to XML

Each mapping key becomes an element. A key written with an @ prefix is emitted as an attribute on its parent element, and a list turns into the same tag repeated once per item. If your document has a single top-level key, that key is used as the XML root element so the result is clean and round-trips with the XML to YAML converter.

All text is XML-escaped, and keys are sanitised into valid element names, so the output is always well-formed.

Supported YAML

The converter handles the YAML people actually paste into an online tool: block mappings and sequences, indentation nesting, inline flow collections like [a, b] and {a: 1}, quoted and plain scalars, comments and the usual null, true, false and number literals.

Out of scope are anchors and aliases, multi-document streams, explicit tags such as !!str, and block scalars (| and >).

Frequently asked questions

How do I create an XML attribute?
Prefix the YAML key with @ — for example '@id: 5' becomes id="5" on the surrounding element.
What becomes the root element?
If the YAML has a single top-level key, that key is the root. Otherwise the output is wrapped in a <root> element.
Is the XML well-formed?
Yes. Text is escaped and keys are sanitised into valid element names, so the XML is always well-formed.

Last updated: