TXT · Text & Data tools

YAML to XML Converter

Input · YAML
Output · XML
0 Bin0 Bout0lines in0keysEmptyYAML
Go to the full Data Format Converter

YAML to XML

Convert YAML to XML. Paste YAML on the left; the XML output builds on the right as you type.

order:
  "@_id": "1042"
  status: shipped
  items:
    - pen
    - notebook

becomes

<?xml version="1.0" encoding="UTF-8"?>
<order id="1042">
  <status>shipped</status>
  <items>pen</items>
  <items>notebook</items>
</order>

order is the single top-level key, so it becomes the root element. The @_id key becomes an id attribute, and each list item under items becomes its own <items> element, since XML represents repetition with repeated tags rather than a list syntax.

One shared engine, not a special case

This pair doesn’t get its own conversion logic. YAML parses to the same plain value that JSON, TOML, or CSV would produce for equivalent data, and the XML builder works from that value without knowing or caring which format it came from. That’s also why quoting a YAML key like "@_id" matters here: YAML would otherwise try to parse the leading @ as part of a tag directive in some contexts, so quoting keeps it a plain string key.

Comments don’t survive

YAML comments are gone by the time the value reaches the XML builder, since comments never make it past the parsing step, the same as YAML to JSON. If you need to keep notes alongside the config, XML comments (<!-- like this -->) would need to be added back in manually after conversion.

Round-tripping

Converting YAML to XML and then that XML back to YAML with the XML to YAML converter won’t necessarily produce byte-identical YAML: attribute ordering, quoting style, and block versus flow YAML style can all differ even when the underlying data is the same.

Frequently Asked Questions

It parses YAML into a plain value, the same value JSON would produce, then builds XML from that. There's no dedicated YAML-to-XML code path; both directions share the same JSON pivot every other pair uses.

Use a key starting with @_ in your YAML, the same convention as JSON to XML. A quoted "@_id": "7" key on an object becomes an id attribute on the enclosing element.

The YAML document's single top-level key, if there's exactly one. Otherwise the Root name field supplies the wrapper element, defaulting to root.

No. Anchors resolve to their full value while YAML is parsed, before XML is built, so an aliased value appears as a normal repeated element rather than any kind of XML reference.

Each list item becomes its own XML element, repeated under the list's key as the tag name, the same rule JSON to XML uses for arrays.

Jump straight to a conversion

Full Data Format Converter tool

Explore Our Tools

Browse all tools