What does a YAML to XML converter do?
YAML is the format people write by hand for configuration. XML is what many older systems still read. Moving between them is mostly a matter of mapping YAML keys to tags and YAML lists to repeated tags.
This YAML to XML converter does not call a YAML library. It has a short parser written for the common cases: nested mappings, dash lists, lists of mappings, quoted strings, numbers, booleans, null, one-line [a, b] and {a: 1}, and | or > block text. The result is built as XML with your Root element and Array item tag.
The catch is that a small parser is forgiving. It rarely reports an error and will quietly misread things it does not know. An anchor such as &base is not expanded, and its content ends up in the wrong place. A value like 007 without quotes becomes 7. Treat the output as a draft, read it against your YAML, and for exotic files use a full YAML library. The reverse direction is available in the XML to YAML converter.
How to convert YAML to XML here
- Paste YAML into YAML Input, or click Sample, which also sets the root to
data. - Type a Root element. The default is
root. - Type an Array item tag for list entries, such as
hostoritem. - Choose XML declaration and Pretty print as needed.
- Press Convert. Always read the result, because the tool does not flag most syntax problems.
- Use Copy or Download .xml to take the result away.
What this YAML parser understands
Nested maps and lists
Indented keys become nested elements. Dash lists become repeated item tags, including lists of maps and lists inside lists.
Quoted strings
Double and single quoted strings are unwrapped, with common escapes like \n and \" handled in double quotes.
Flow notation
One-line lists like [a, "b c", 3] and maps like {a: 1} are read, though only on a single line.
Block text
A key followed by | keeps line breaks. A key followed by > folds lines into one.
Comments and separators
Text after a space and hash is dropped as a comment, and the --- line is skipped.
Safe tag names
Keys with spaces or symbols are cleaned to valid XML names, and null values become xsi:nil elements.
Where YAML to XML conversion helps
- Handing a config to an XML-only service. A team keeps settings in YAML but a legacy deployment tool reads XML. Convert a copy and adjust the tag names.
- Explaining a structure to someone who reads XML. Show a colleague what your YAML list looks like as repeated tags before writing the real integration.
- Creating sample XML for tests. Write the data quickly in YAML, which is faster to type, and convert it into XML for a test fixture.
- Checking how a YAML list maps. Learners can see how maps, lists and nulls translate and spot where an XML schema would need attributes.
Tips and limits of the built-in parser
- Quote values that must stay strings. An unquoted
007becomes7, while"007"stays as is. - Do not rely on anchors, aliases, tags or several documents in one file. They are not processed and may produce odd output.
- Keep flow lists on one line. A list that spans several lines inside square brackets is not read.
- Use spaces, not tabs, for indentation. The parser counts spaces.
- If a key looks wrong in the output, its original name probably had spaces or started with a digit. Check the cleaned tag name, or compare with the JSON to XML converter if you have JSON available. A regex tester helps if you need to bulk-edit key names first.
Is it safe? Privacy and limits
The YAML is parsed and converted by JavaScript in your browser, with no upload, no network call and no account. The tool does not validate YAML against a specification and does not support anchors or custom tags. Because the parser is lenient, an error-free result does not prove the YAML was read correctly. Verify the output before using it in production, and do not paste secrets into shared computers.
YAML to XML converter FAQ
It supports nested mappings, lists made with dashes, lists of mappings, lists inside lists, quoted strings, integers, decimals, true and false in a few spellings, null and tilde, one-line [a, b] and {a: 1} notation, comments after a space and a hash, and | and > block text. It does not support anchors, aliases, merge keys, custom tags, complex keys or several documents in one file. Those will either be ignored or give wrong output, so expand or remove them first and re-run the conversion afterwards.
The built-in parser is lenient by design. Lines it cannot understand, such as a line with no colon in a mapping, are usually skipped. So invalid YAML often converts into something that looks plausible. Only a few failures show the red Invalid YAML message. This means a clean result is not proof of valid input. If correctness matters, run your file through a strict YAML linter first, then use this tool for the conversion step.
Each list becomes an element named after its key, with one child per entry. The child tag is the value in the Array item tag field, which defaults to item. If a list item is a map, its keys become nested elements inside that item. A list inside a list repeats the item tag at each level. An empty list becomes a self-closing tag. You cannot give different entries different tags, since YAML lists have no names, so a list of mixed things needs a hand edit afterwards.
They are not resolved. A line like base: &b followed by indented keys will not create a reusable block. The marker text can appear as a value, and the indented keys can be attached to the wrong parent. An alias such as *b is just treated as text. If your file uses anchors, expand them first with a full YAML tool, or write the values out in full before converting.
Unquoted values that look like integers are parsed as numbers, and a number has no leading zeros. So 007 becomes 7 and the leading zeros are lost. Wrap the value in quotes, as in "007", and it stays text. Hex like 0x1F and dates like 2024-01-01 are kept as text, because only plain integers and decimals are turned into numbers. Since XML has no types, the receiving system has to decide how to read the digits. This matters for zip codes, phone numbers and IDs.
A value written as null, Null, NULL, a tilde, or left empty becomes null. In the XML that is an element with xsi:nil="true", and the xsi namespace is declared on the root only when needed. A key with an empty list becomes a self-closing tag. If you prefer to leave nulls out, delete those lines from the YAML before converting. Empty strings written as '' stay as empty elements and are not treated as null.
You can convert one document, and simple files will work. Real manifests often use several documents separated by ---, anchors, long multi-line values and unusual quoting, and these are where a small parser struggles. Also, XML has no standard way to express Kubernetes types, so the output will only be a literal tree of tags. Treat it as a sketch, and check every section against the original, since mistakes here can be silent and easy to miss.
No. All of the work happens in your browser tab, and there is no upload or login. The page keeps no history. You can use Download .xml to save the result as output.xml on your own device, and nothing is stored on any server in the process. As with any web page, avoid pasting passwords or API keys, and clear the input box when you finish on someone else's computer. Closing the tab removes everything.