XML to YAML
Convert XML config to YAML: attributes get an @ prefix, repeated tags become lists, and values that look like numbers are quoted
Your data stays with you. Conversion happens inside the browser; nothing is sent to a server.
Did this tool do the job?
Thanks, your feedback came through.
How it works
If you are moving an old Java XML config, or the XML output of a service, into a Kubernetes manifest, an Ansible playbook or Spring Boot's application.yml, paste the XML into the left pane. The YAML shows up on the right as soon as you paste. The root tag becomes the top-level key: a document that starts with <server> starts with a "server:" line. Attributes get an @ in front (env="production" → "@env": production), and a tag that appears twice under the same parent (two <role> tags) becomes a list under one key. XML has no number or boolean type, so <port>8080</port> is text. YAML, however, reads an unquoted 8080 as a number and an unquoted on as true in older parsers. That is why the tool writes such values as "8080" and "on" and tells you in the result line how many it quoted. Remove the quotes only on purpose: if the target program expects a number for that field, removing them is right. Choose 2 or 4 spaces of indentation; tabs are not allowed in YAML. Comments, processing instructions (<?...?>) and DOCTYPE are not carried over.
This tool is also known as xml to yaml, xml to yaml converter, convert xml to yaml, xml to yaml online, xml to yml.
What is YAML?
YAML is a data format that shows structure through indentation instead of brackets; Kubernetes manifests, GitHub Actions workflows, docker-compose files and Spring Boot's application.yml all use it. Each line is "key: value" or "- item", nesting is done with spaces, and tabs are not allowed. The parser guesses the type of unquoted values, which is convenient when you write YAML by hand and risky when the data comes from XML, where everything is text.
What is XML attribute?
An attribute is extra information written inside an XML opening tag as name="value": in <server env="production">, env is an attribute. YAML has no separate place for attributes; they and child elements both become keys. That is why the converter puts @ in front of an attribute name: the distinction survives, and when XML is generated again from the YAML, the tool knows which keys were attributes.
What is the difference between XML and YAML?
XML wraps every value in an opening and a closing tag, can carry attributes and can be validated against a schema (XSD); the price is length. YAML writes the same structure with indentation and no tags, which makes it much shorter and popular for hand-edited config files. The big difference is types: in XML, 8080 is text; in YAML, an unquoted 8080 is a number. Attributes and mixed text have no YAML equivalent and travel through naming rules such as @ and #text. Use XML when a program demands it, YAML when people edit the file.
The trap: "on" in XML can become true in YAML
XML carries every value as text; a schema or the program decides the type. YAML guesses the type of an unquoted value itself: 8080 is a number, true is a boolean, null is empty. YAML 1.1 parsers (PyYAML, older Ruby, some Ansible versions) also treat yes, no, on, off and dates like 2026-09-27 as special. Written without quotes, <https>on</https> would turn into true, and NO for Norway in a country list would turn into false. The tool therefore double-quotes every value that looks like another type.
The same protection works for IDs: a phone number or ZIP code with a leading zero would lose it if a parser read it as a number. With quotes, the YAML reader sees exactly the text the XML had.
- <port>8080</port> → port: "8080"
- <https>on</https> → https: "on" (unquoted on = true in YAML 1.1)
- <country>NO</country> → country: "NO" (unquoted NO = false)
- <name>tool-corner</name> → name: tool-corner (no quotes needed)
How attributes, lists and mixed text are written
Three XML structures have no direct YAML equivalent, and the tool follows the same rules as the XML to JSON converter for all three, so the two outputs match. An attribute becomes a key with @ in front of its name: <item id="7"> → "@id": "7". Because @ is reserved in YAML, the key is written in quotes.
A tag repeated under the same parent becomes a list; a tag that appears once does not. So when an <item> is alone, the YAML shows a mapping, not a list — keep that in mind if your code always expects a list. When an element has both text and child tags, its text goes under a "#text" key. The YAML to XML converter applies the same rules in reverse: "@id" becomes an attribute again.
Frequently asked questions
How do I convert an XML file to YAML?
Open the XML file in any text editor, copy its content and paste it into the left pane on this page. The YAML appears on the right immediately; choose 2 or 4 spaces of indentation, then copy the result or download it as a .yaml file. If the XML is malformed, the error message names the tag and the line number.
Why are some values in quotes in the YAML output?
Every value in XML is text, but YAML reads an unquoted 8080 as a number, on and yes as true and NO as false. To keep the meaning, the tool quotes values that look like another type and shows how many it quoted. If the target program expects a number, you can remove the quotes yourself.
Do XML attributes get lost in YAML?
No. Each attribute is written as a key with @ in front of its name: <server env="production"> → "@env": production. Namespace declarations (xmlns) are kept as attributes too. The YAML to XML converter turns these keys back into attributes.
Is my XML sent to a server?
No. Parsing the XML and writing the YAML both happen inside your browser, so passwords or hostnames in your config never leave this page. Once the page has loaded, it works without an internet connection.