YAML to XML Converter
Turn YAML into valid XML — or XML into clean YAML — as you type. Keys starting with “@” become attributes, lists become repeated elements, and anchors are expanded for you.
At a glance
- Converts YAML to XML and XML to YAML, instantly as you type. Switching direction carries the result across.
- Keys that start with @ become XML attributes and #text becomes the text of an element — the same convention as the XML to JSON converter, so data converts there and back unchanged.
- A YAML list repeats the element (
<tag>a</tag><tag>b</tag>) or wraps each item (<tags><item>a</item>…</tags>), whichever your XML needs. - XML needs exactly one root: YAML with several top-level keys, a top-level list or several documents is wrapped in a root element you can name.
- Anchors, aliases and merge keys (
<<) are written out in full, and numbers keep their digits:799.00stays799.00. - From XML, text that YAML tools could misread —
00482,yes,2026-01-15— is written in quotes, so leading zeros and codes survive. - Mistakes in the YAML or the XML are reported with their line and column.
- Runs in your browser: nothing you paste is uploaded.
Step by step
How to convert YAML to XML
- 1
Add your YAML
Paste YAML into the input, or click Open file to load a .yaml or .yml file.
- 2
Mark attributes
Give a key the prefix
@(in quotes, as"@id") to make it an attribute, and use#textfor the text of that element. - 3
Adjust the options
Open Options to name the root and item elements, wrap list items, use CDATA or drop the XML declaration.
- 4
Copy or download
Copy the XML or download it as a .xml file. Choose XML → YAML to convert in the other direction.
Features
Everything you need, nothing you don’t
Both directions
YAML → XML and XML → YAML in one tool, with options for each side. Convert, edit and convert back.
Attributes and text
"@id": 7 becomes id="7", and #text holds the text of an element that also has attributes. Choose _, - or $ as the prefix instead.
Always valid XML
A root element is added when needed, keys that are not valid XML names are fixed and listed, and &, < and > are escaped or put in CDATA.
Clean, safe YAML
Numbers and booleans are converted, while IDs with leading zeros and words like no stay quoted text that every YAML parser reads the same.
Exact error locations
A wrong indent or an unclosed tag is reported with its line and column, and one click jumps to it in the input.
Private
Build files, configs and feeds are converted on your device. Nothing is sent to a server.
How YAML becomes XML
| YAML | XML |
|---|---|
name: Asha | <name>Asha</name> |
user: with "@id": 7 inside | <user id="7">…</user> |
price: with "@currency": INR and "#text": 799.00 | <price currency="INR">799.00</price> |
tag: with - a and - b | <tag>a</tag><tag>b</tag>, or <tag><item>a</item><item>b</item></tag> with Wrap items |
notes: null or notes: "" | <notes/> |
first name: x | <first_name>x</first_name> (renamed, and reported) |
| two top-level keys | both wrapped in <root> |
How XML becomes YAML
| XML | YAML |
|---|---|
<name>Asha</name> | name: Asha |
<user id="7"/> | user: with "@id": 7 inside |
<tag>a</tag><tag>b</tag> | tag: with - a and - b |
<sku>00482</sku> | sku: "00482" (leading zero kept) |
<answer>yes</answer> | answer: "yes" (quoted, so it stays text) |
<count>42</count>, <live>true</live> | count: 42, live: true |
<![CDATA[<b>bold</b>]]> | <b>bold</b> as plain text |
Good to know
- YAML reserves the
@character, so attribute keys must be written in quotes:"@id": 7. Choose the_prefix in Options for keys that need no quotes, such as_id. - An empty YAML list has no XML form when elements repeat, so it is left out and reported. Wrap items keeps it as an empty element.
- YAML comments are not carried over, and XML comments and the
<?xml ?>declaration are dropped when converting to YAML. - Several YAML documents separated by
---become one<item>each inside the root element. - When reading YAML you can choose YAML 1.2 or 1.1. Under 1.1,
debug: nobecomes<debug>false</debug>; under 1.2 it stays<debug>no</debug>.
FAQ
Frequently asked questions
How do I create XML attributes from YAML?
@ and put it in quotes, because YAML reserves that character: "@id": 7 inside user: gives <user id="7">. To add text to the same element, use the key "#text".Why was my data wrapped in a root element?
<root> element is added — rename it under Options.Is it safe to convert private configuration files?
Why are some values quoted in the YAML?
00482, yes or 2026-01-15 would be read by some YAML tools as a number, true or a date. Quoting keeps them as the text the XML contained. Turn off Safe for YAML 1.1 tools to quote less.What happens to anchors and aliases?
*name) and merge key (<<) is replaced by a full copy of the data it refers to.Why is a single element not a list in the YAML?
Does it work with pom.xml, RSS or SVG files?
Keep going
Related tools
JSON to YAML Converter
Convert JSON to YAML and YAML to JSON online. Quotes yes, no and 0755 so every parser reads them the same, keeps numbers exact and never uploads your data.
XML to JSON Converter
Convert XML to JSON and JSON to XML online. Keeps attributes, arrays and leading zeros intact, shows exact error lines and never uploads your data.
JSON to XML Converter
Convert JSON to XML online: attributes, text, arrays and nested data, with a root element, CDATA and pretty or minified output. Free and private, no upload.
JSON Formatter & Validator
Format, validate, minify and repair JSON online. Get the exact line and column of every error, a collapsible tree view and sorted keys — private, in-browser.
DNS Lookup
Free DNS lookup: check A, AAAA, CNAME, MX, NS, TXT, SOA and CAA records of any domain, see SPF and DMARC, and do reverse DNS for an IP address.
DNS Propagation Checker
Check DNS propagation worldwide: see the A, CNAME, MX, NS or TXT answer from 7 public DNS networks and 18 ISPs in 15 countries, and track the change.
Last updated Report a problem or suggest a feature