100% local — your data never leaves your browser

YAML to XML — Element Names That Work

Convert YAML to XML. Keys that cannot be element names are repaired and collisions get a suffix, so the document parses on the first try.

Instant Private Zero cookies
Indentation

YAML input

XML output

What this tool does

Keys become elements, values become their contents.

user:
  name: Ada
  born: 1815
<user>
  <name>Ada</name>
  <born>1815</born>
</user>

A document with several keys at the root is wrapped in <root>, because XML allows exactly one root element.

Keys are repaired, not emitted broken

An XML element name may not contain a space, may not start with a digit, and is limited to a specific set of characters:

keyelement
user name<user_name>
2nd<_2nd>
user-name<user-name> (already legal)

Writing the key as it stands would produce a file that looks like XML and that no parser will accept — the kind of output that fails much later, somewhere else.

Two keys that repair to the same name

user name and user_name both want to be user_name. The second becomes user_name_1.

The alternative is to let one overwrite the other, and a value disappearing without a word is exactly what this tool tries not to do.

Lists become repeated elements

items:
  - 1
  - 2
<items>
  <item>1</item>
  <item>2</item>
</items>

XML has no list type; repetition is the list. The name item has to come from somewhere, and nothing in the YAML offers one.

Attributes, if you want them

A key spelled "@_id" becomes an attribute, and "#text" becomes the element’s text:

"@_id": 1
"#text": hello
<root id="1">hello</root>

That is the convention the XML-to-YAML direction emits, so the round trip keeps its shape.

Private by design

Everything runs locally in your browser with JavaScript. Your data is never uploaded, which makes the tool safe for sensitive content, and it keeps working offline.

Frequently asked questions

What happens to a key that is not a valid element name?
It is repaired. XML names cannot contain spaces and cannot start with a digit, so `user name` becomes `user_name` and `2nd` becomes `_2nd`. Emitting the key as written would produce a document that no parser will read — a file that looks fine until something tries to open it.
What if two keys repair to the same name?
`user name` and `user_name` would both give `user_name`, so the second gets a suffix: `user_name_1`. Merging them would drop one value silently, which is the failure this whole page exists to avoid.
Can I produce attributes rather than elements?
Yes. A key written `"@_id"` becomes the attribute `id`, and a key written `"#text"` becomes the element’s text content. That is the same convention the XML-to-YAML direction produces, so a document converted to YAML and back comes out the same shape.

Related converters