XML to YAML Converter
Convert XML to clean, readable YAML: attributes become @keys, repeated elements become lists, and any string YAML might misread — yes, no, 1.0, dates — is quoted for you.
XML to YAML Converter
Runs in your browser — nothing you enter is uploaded or stored.
Scratchpad auto-saved
How it works — in four simple steps
No signup and nothing to install — it all runs in your browser.
Add your XML
Paste it into the left box, press Open file, or drag a .xml file onto it. Sample loads a realistic example.
Set the options
Adjust the options above the boxes — the output updates instantly as you change them.
Check the result
Read the status line: it reports rows, keys and any value that couldn't be represented in YAML.
Copy or download
Copy the YAML or download it as a .yaml file. Nothing was uploaded at any point.
Untick Detect numbers when values like versions (1.10) must stay exactly as written.
Features
Attributes kept, clearly marked
XML attributes become keys with an @ prefix (or _ / - / none), so they never collide with child elements of the same name.
Real types, not just strings
Numbers, booleans and empty values are detected — while codes with leading zeros such as 00742 or +44 phone numbers stay text.
Namespace control
Keep prefixes like dc:title, or strip them to get plain keys when the namespaces don't matter to you.
Stable array shape
Optionally make every child element an array, so code doesn't break when a list happens to have only one entry.
Document marker
Optionally start the file with --- for tools that expect an explicit YAML document.
Private by design
Parsing and conversion run in your browser with JavaScript — your data is never uploaded, logged or stored.
About the XML to YAML Converter
Teams moving configuration from XML (Maven, Spring, .NET app.config, Ant) to YAML (Kubernetes, GitHub Actions, Docker Compose, Spring Boot's application.yml) usually want the same data with less noise. This converter parses the XML into a tree using the same rules as our XML to JSON tool — attributes as @keys, repeated elements as lists, text-with-attributes in #text — and writes that tree as block-style YAML.
The YAML writer is careful about the values YAML parsers interpret on their own. Strings such as yes, no, on, off, null, anything that looks like a number, a date like 2026-10-21 or a time like 12:30 are quoted, so they stay strings in every parser — including the YAML 1.1 parsers still used by PyYAML and many CI systems. Keys starting with @ are quoted too, because @ is reserved in YAML.
Longer multi-line text is written as a | block scalar, which keeps line breaks exactly; short multi-line values are written as a quoted string with
. XML comments are dropped since they aren't part of the data model.
Examples
A small XML configuration with attributes, a repeated element, a boolean-looking value and a multi-line message.
<config env="prod">
<app>
<name>billing</name>
<version>1.10</version>
<enabled>yes</enabled>
</app>
<server host="db-1" port="5432"/>
<server host="db-2" port="5432"/>
<banner>Welcome to billing.
Unauthorised access is prohibited.</banner>
</config>config:
"@env": prod
app:
name: billing
version: "1.10"
enabled: "yes"
server:
- "@host": db-1
"@port": "5432"
- "@host": db-2
"@port": "5432"
banner: |-
Welcome to billing.
Unauthorised access is prohibited.This output was produced by the converter on this page with Detect numbers switched off (so 1.10 stays “1.10”) — load it with the “Spring beans” preset above and change any option to see the effect.
How XML maps to YAML
| In XML | Becomes in YAML |
|---|---|
<port>8080</port> | port: 8080 |
Attribute env="prod" | "@env": prod |
Repeated <server> | a YAML list - … |
<enabled>yes</enabled> | enabled: "yes" (quoted, stays a string) |
<date>2026-10-21</date> | date: "2026-10-21" |
| Long multi-line text | | block scalar |
| Empty element | "" |
Things that trip people up
- @ keys look odd in YAML. Attributes need a marker so they don't clash with child elements. Switch the attribute prefix to _ or none for friendlier YAML if your XML never uses the same name for both.
- Order of mixed children. If an element alternates children (
<a/><b/><a/>), bothaentries are grouped into one list, so the original interleaving isn't kept. - Numbers that should be strings. Version-like values (
1.10) would become the number 1.1. Untick Detect numbers to keep every value as a quoted string. - Namespaces. Spring and Maven files are full of xmlns declarations, which become
@xmlnskeys. Strip namespace prefixes for a cleaner result.
XML vs YAML at a glance
| Property | XML | YAML |
|---|---|---|
| Specification | XML 1.0 Fifth Edition (W3C, 2008) | YAML 1.2.2 (2021) |
| File extension | .xml | .yaml / .yml |
| Media type | application/xml (RFC 7303) | application/yaml (RFC 9512) |
| Data types | text only (types come from a schema) | string, int, float, bool, null, map, sequence (+ dates in many parsers) |
| Comments | Yes <!-- --> | Yes # |
| Nesting | Unlimited | Unlimited (indentation) |
- XML: A document has exactly one root element; element names can't start with a digit, and only five entities (& < > " ') are predefined.
- YAML: YAML 1.2 is a superset of JSON; YAML 1.1 parsers (still common) also read yes/no/on/off as booleans — the “Norway problem”.