XML to YAML Converter
This XML to YAML converter turns a document into readable, two-space indented YAML: elements become keys, their children become the nested mapping beneath, and repeated elements with the same name become a list. Attributes are preserved with an @_ prefix so they stay distinguishable from child elements, and the XML declaration is dropped because YAML has no equivalent. Text nodes are all strings in XML but YAML has real scalars, so values that look like numbers or booleans are written as such — a replicas element holding 3 becomes replicas: 3 rather than a quoted string. Runs entirely in your browser.
How it works
Elements become YAML keys, repeated elements become lists, and attributes are kept with an @_ prefix so they stay distinguishable from child elements. The XML declaration is dropped because YAML has no equivalent.
Text and numbers are converted to their natural YAML types, so <replicas>3</replicas> becomes replicas: 3 rather than a quoted string.
The conversion runs entirely in your browser — nothing you paste or upload is sent to a server.
How to convert XML to YAML
- Paste your XML, or upload an
.xmlfile. - The YAML equivalent appears on the right, indented two spaces.
- Copy or download it, ready to drop into a config file.
How the structure maps across
- Each element becomes a key, and its children become the nested mapping under it.
- Repeated elements with the same name become a YAML list.
- Attributes are kept as keys prefixed with
@_, so they stay distinct from child elements. - The
<?xml ... ?>declaration is dropped, because YAML has no equivalent.
Types are inferred
XML text nodes are all strings, but YAML has real scalars. Values that look like numbers or booleans are written
as numbers or booleans, so <replicas>3</replicas> becomes replicas: 3 rather
than a quoted string — which is what a config parser downstream will expect.
Common use cases
- Migrating an old XML configuration to a YAML-based tool.
- Reading a verbose XML document in a format that is easier on the eyes.
- Turning an XML fixture into a YAML test fixture.
Frequently asked questions
How do I convert XML to YAML?
Paste your XML or upload an .xml file, and the YAML equivalent appears on the right with two-space indentation, ready to copy into a config file.
How do XML elements map onto YAML?
Each element becomes a key and its children become the nested mapping under it. Several elements with the same name become a YAML list, which is how XML expresses repetition.
What happens to XML attributes?
They are kept as keys prefixed with @_, so an attribute and a child element with the same name stay distinguishable instead of one silently overwriting the other.
Are numbers and booleans converted to real YAML types?
Yes. XML text nodes are all strings, but values that look like numbers or booleans are written as YAML scalars, so a replicas element holding 3 becomes replicas: 3 rather than a quoted string a config parser would reject.
Why is the XML declaration missing from the output?
The declaration specifies the XML version and character encoding, neither of which has a YAML equivalent, so it is dropped rather than turned into a meaningless key.
Is my XML uploaded during conversion?
No. Parsing and conversion happen entirely in your browser, so nothing you paste or open is sent to a server.
Related tools
YAML to XML Converter
This YAML to XML converter turns mappings into nested elements and sequences into repeated ones.
XML to JSON Converter
This XML to JSON converter parses XML into JSON online, preserving attributes and repeated tags as arrays.
XML to CSV Converter
This XML to CSV converter turns repeated elements into spreadsheet rows, attributes included.