XML Tools
XML to YAML
Turn XML document data into readable YAML for review or configuration work. The conversion keeps root names, @-prefixed attributes, repeated elements, and string values explicit.
✓ Every tool runs in your browser. We do not upload your input or output.
Keyboard shortcuts
Ctrl/⌘ + Enter: process
Ctrl/⌘ + Shift + F: full screen
Esc: exit full screen
Ctrl/⌘ + F in editor: search
How to use
- Paste XML, upload an .xml file, or load the sample orders.
- Process the document to create YAML with the XML root as its top-level key.
- Review attribute keys beginning with @ and sequences created from repeated child elements.
- Copy or download the YAML, then check that its mapping fits the application that will consume it.
Examples
Convert one service setting
The environment attribute is explicit, and the port stays a string rather than being guessed as a number.
<service env="staging"><port>8080</port></service>
service: '@env': staging port: '8080'
Convert repeated endpoints
The two route elements become a YAML sequence in their original order.
<routes><route>/health</route><route>/ready</route></routes>
routes:
route:
- /health
- /ready
Read XML data as YAML
XML often stores configuration or export records in deeply nested tags. YAML can make the same data easier to read in a review or draft configuration file. This converter first maps XML into a predictable data structure, then writes that structure as YAML. The XML root becomes the top-level YAML key; child elements become nested keys, and repeated siblings become sequences.
Attributes use an @ prefix. For example, <service env="staging"> produces an @env key within service. This avoids silently merging an attribute with a child <env> element. Text from a leaf element remains a string, even when it resembles a number, boolean, or date. Review the downstream schema before changing any of those values to native YAML types.
Know what carries over
The conversion focuses on document data. It keeps mixed text and child element order in a #content sequence when needed. It does not carry XML comments, processing instructions, or CDATA boundaries into the YAML mapping. XML declaration details are also outside the data result. If those details matter, keep the original XML alongside the YAML.
Parsing is strict about matching tags and namespace prefixes. DOCTYPE declarations are rejected, and the tool never fetches external resources. Your input and output remain in the browser; large files are processed in a Web Worker while the workspace stays scrollable and responsive.
Frequently asked questions
Why do attribute keys start with @?
The prefix distinguishes an XML attribute from a child element that could have the same name.
Will YAML infer numbers from XML text?
The converter keeps XML text as strings. The YAML writer quotes values when needed so a YAML parser does not reinterpret them.
How are repeated tags handled?
Sibling elements with the same name become a YAML sequence. A single element remains one value.
What happens to comments and processing instructions?
They are not included in the data mapping. Use XML Formatter to retain document-level markup.
Can I use this as a lossless XML archive?
No. YAML is useful for the mapped data, but XML-specific syntax and comments are not preserved for a perfect round trip.