YAML

YAML to XML Converter

Converts YAML to XML, letting you name the root and the element used for sequence items.

Loading the tool…

Processing happens locally in your browser. What you paste or load is processed by this page and is not uploaded to a server. Nothing is stored unless you use a control that says it stores something, and you can clear anything this site has kept from the privacy page.

How to use this tool

  1. Paste the YAML you want as XML.
  2. Set the root element name, and the name to use for each item of a sequence.
  3. If a schema is waiting at the other end, use the names that schema expects rather than the defaults.
  4. Select Convert to XML and download the result.

What yaml to xml does

XML needs two names that YAML does not have. It needs a single root element, where a YAML document can be a mapping, a sequence or a bare scalar, and it needs a name for each item of a sequence, where YAML items are anonymous. Both are settings on this page rather than something guessed at, because a name invented for you will not match the schema on the other end.

The usual reason to do this is an older system that speaks XML sitting downstream of tooling that speaks YAML. If a schema is involved, set the root and item names to the ones it expects before converting; renaming elements afterwards across a large document is far more annoying than setting two fields here.

Frequently asked questions

Because XML requires exactly one root element and YAML has no such concept — a document can be a mapping, a sequence or a bare scalar. Rather than invent a name and have it fail a schema check downstream, the tool asks you for it.

A YAML sequence has anonymous items, and XML has no anonymous element. Every item needs a tag, so you choose the tag. If a schema is involved, use the name it expects; renaming elements across a converted document afterwards is far more work than setting the field here.

It is rewritten into a valid name, and the original is kept on the element as a key attribute so nothing is lost. XML element names cannot start with a digit or contain spaces, and configuration keys regularly do both.