Skip to content
MyDailyTool

XML to YAML Converter

Convert XML documents to clean indented YAML. Handles attributes, repeated elements, and text content; great for migrating legacy configs.

How to use the xml to yaml converter

Paste XML on the left. Clean indented YAML appears live on the right. Elements become keys; attributes prefix with "@_"; mixed-content text lives under "#text".

Formula & explanation

XML → JS value → YAML. Repeated sibling elements collapse into YAML sequences; attributes stay distinguishable via the @_ prefix.

Examples

<book id="1"><title>Demo</title></book> becomes book:\n "@_id": 1\n title: Demo

Frequently asked questions

Can I round-trip XML through YAML and back?
For most documents yes — the @_ prefix convention preserves attribute-vs-element information. Edge cases (mixed content, namespaces with bound prefixes) may need manual adjustment.
Why are some YAML keys quoted?
Keys starting with "@_" need quoting in YAML because the @ character isn't valid as a bare scalar. The output handles this automatically.

Related developer tools tools