Convert XML to YAML
Convert XML data to YAML format. Preserves structure, attributes, and text content. 100% client-side.
Paste your XML, get valid YAML back — with nested elements, attributes, and repeated tags all mapped correctly. No fiddling with indentation by hand or guessing how arrays should look.
It parses the full DOM tree, turns sibling elements into YAML sequences, and prefixes attributes with "@" so nothing collides. And everything runs in your browser. Nothing gets uploaded.
How It Works
The browser's built-in XML parser reads your document into a DOM tree. Each element becomes a YAML key, child elements become nested objects, and repeated tags get grouped into arrays automatically. Attributes show up with an "@" prefix so they don't clash with child element names.
Examples
Simple Config File
A basic app configuration with a few settings — the kind you'd find in a Spring Boot or .NET project.
<config>
<database>
<host>localhost</host>
<port>5432</port>
<name>myapp_db</name>
</database>
</config>
config:
database:
host: localhost
port: "5432"
name: myapp_db
XML with Attributes
Attributes get an "@" prefix in YAML so they stay separate from child elements. This is how a book catalog with ISBN attributes converts.
<catalog>
<book isbn="978-0-13-468599-1">
<title>The Pragmatic Programmer</title>
<price>49.99</price>
</book>
</catalog>
catalog:
book:
"@isbn": "978-0-13-468599-1"
title: The Pragmatic Programmer
price: "49.99"
Repeated Elements Become Arrays
When multiple sibling elements share the same tag name, the converter groups them into a YAML sequence. Common in API responses and data feeds.
<users>
<user>
<name>Alice</name>
<role>admin</role>
</user>
<user>
<name>Bob</name>
<role>editor</role>
</user>
</users>
users:
user:
- name: Alice
role: admin
- name: Bob
role: editor
Who Uses This
Migrating legacy XML configs to YAML for Kubernetes, Docker Compose, or CI/CD pipelines.
Converting Maven POM files or Ant build scripts into YAML-based workflows.
Turning XML data exports into YAML for easier reading and quick edits in a text editor.
Learning how XML structures map to YAML by seeing side-by-side conversions in real time.
Common Mistakes
Missing a closing tag or having mismatched brackets will throw a parse error. Run your XML through a validator first if you're not sure it is well-formed.
XML namespaces like <soap:Envelope> will carry the prefix into your YAML keys. Strip them from the source XML beforehand if you don't want "soap:Envelope" as a key name.
XML treats everything as text. So <port>5432</port> becomes port: "5432" in the output. That's correct behavior — you can remove the quotes manually if your YAML parser needs a raw integer.
Technical Details
- Processing: 100% client-side — nothing is uploaded
- Browser Support: Chrome, Firefox, Safari, Edge
- Max File Size: Limited only by your browser's memory
- Attribute Handling: Togglable "@" prefix notation
- Array Detection: Automatic grouping of repeated sibling elements
Frequently Asked Questions
How does the converter handle XML attributes?
Attributes get an "@" prefix in the YAML output. So <book id="1"> becomes @id: "1" nested under the book key. There is a toggle in the toolbar if you want to skip attributes entirely.
Can I convert YAML back to XML?
This tool goes one direction — XML to YAML. For the reverse, check our YAML to XML converter. Round-tripping works best when you haven't manually edited the YAML structure after conversion.
What happens with XML CDATA sections?
CDATA content is treated as plain text. The CDATA wrapper gets stripped and the raw text inside becomes the YAML value for that element. No special markers are added.
Is my XML data safe? Does it get stored anywhere?
Completely safe. The conversion runs entirely in your browser using JavaScript. Nothing gets sent to a server, nothing is logged, and nothing is stored. Close the tab and it's gone.
Why are all my numbers wrapped in quotes in the YAML output?
XML doesn't have data types — everything is a string. The converter preserves that by quoting numeric values. If you need unquoted numbers for your YAML parser, you'll need to remove the quotes manually or run a post-processing step.