XML to YAML
Paste any XML document and get readable YAML back, entirely in your browser.
Example
A simple XML document with attributes and repeated tags becomes nested YAML:
<note id="1">
<to>Tove</to>
<from>Jani</from>
<tag>a</tag>
<tag>b</tag>
</note>
becomes:
note:
'@id': 1
to: Tove
from: Jani
tag:
- a
- b
How it works
It parses the XML with the browser's DOMParser, builds a plain value model (repeated tags become arrays, attributes get an "@" prefix, text becomes "#text" when mixed), then serializes that model to YAML with js-yaml.
Good to know
This XML to YAML converter turns any well-formed XML document into clean, indented YAML directly in your browser. It is built for developers, DevOps engineers, and config authors who need to move data out of an XML format (an API response, a legacy config file, an RSS feed, a build manifest) and into the more readable YAML syntax used by tools like Kubernetes, GitHub Actions, Ansible, and Docker Compose. Because everything runs client-side with the browser's own DOMParser and the js-yaml library, nothing is uploaded and it keeps working offline after the page loads.
Reach for it when you are hand-translating XML into a YAML config, sanity-checking the shape of an XML payload, or generating YAML fixtures for tests. The tool converts as you type and also exposes a Convert button, a Load sample to see a realistic example, a Copy output button, and Clear. If the XML is malformed, you get an inline parser error (truncated to the first line) instead of silent or partial output, so a blank result usually means your input did not parse.
Reading the output comes down to a few consistent mapping rules. Element nesting becomes nested YAML keys; attributes appear as keys prefixed with @ (so id="1" becomes '@id': 1) to avoid clashing with child elements; repeated sibling tags collapse into a YAML list in document order; and when an element has both text and attributes or children, the bare text is stored under a #text key. The converter also infers scalar types, so true, false, null, and numeric strings are emitted as native YAML booleans, nulls, and numbers rather than quoted strings.
A practical caveat: that automatic type coercion means values like a ZIP code, a leading-zero ID, or a version string can change meaning once converted (for example 007 may not round-trip). XML namespaces, comments, processing instructions, and CDATA are flattened or dropped rather than preserved, and an empty element becomes null. If you need a guaranteed lossless round trip, review the output against the source, and pair this with the YAML to XML tool to check that the data survives the trip back.
Frequently asked questions
How are XML attributes represented in the YAML output?
Each attribute is emitted as a key prefixed with @ (for example id="1" becomes '@id': 1) so attributes never collide with child element names.
What happens when a tag appears multiple times?
Repeated sibling elements with the same tag name are collapsed into a YAML list (array), preserving their document order.
Is my data uploaded anywhere?
No — this tool runs entirely in your browser. Your input never leaves your device and it works offline once loaded.
Is it free?
Yes, completely free with no sign-up and no limits.
People also ask
What is the difference between XML and YAML?
XML uses angle-bracket tags and attributes to mark up data and is verbose, while YAML uses indentation and minimal punctuation to represent the same structures (maps, lists, scalars) far more compactly. YAML is common for modern config files, whereas XML is widespread in older enterprise systems, SOAP APIs, and document formats.
Why does my number or ZIP code lose its leading zeros after converting?
The tool infers scalar types, so a value that looks numeric like 007 is emitted as the number 7 rather than the string "007". To keep such values intact, treat them as strings in the source or quote them in the resulting YAML before using it.
How are nested XML elements with the same tag name converted?
Repeated sibling elements that share a tag name are grouped into a single YAML list under that key, and their order in the document is preserved. A tag that appears only once stays a single mapped value rather than a one-item list.
Can this convert XML with namespaces or CDATA sections?
Namespaced tag names are kept as written (including the prefix), but the tool does not specially resolve namespaces, and comments and processing instructions are ignored. CDATA and ordinary text are read as text content, so structural markup metadata is not preserved in the YAML.
Does converting XML to YAML and back produce identical XML?
Not always. Attribute prefixes, list grouping, type inference, and dropped comments or namespaces mean some details can shift, so a YAML-to-XML round trip may differ from the original. Verify both outputs if a lossless conversion matters.
Is there a size limit for the XML I can paste?
There is no fixed limit imposed by the tool, but since parsing and conversion happen entirely in your browser, very large documents are bound by your device's memory and may run slowly. Smaller files convert instantly as you type.
Why is my output blank or showing an error?
A blank output usually means the XML failed to parse; the tool shows an inline parser error message when that happens. Common causes are unclosed tags, missing a single root element, or invalid characters in the markup.
Related tools