Skip to content
JustTools

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.

Runs in your browser Free · no sign-up

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.00 stays 799.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. 1

    Add your YAML

    Paste YAML into the input, or click Open file to load a .yaml or .yml file.

  2. 2

    Mark attributes

    Give a key the prefix @ (in quotes, as "@id") to make it an attribute, and use #text for the text of that element.

  3. 3

    Adjust the options

    Open Options to name the root and item elements, wrap list items, use CDATA or drop the XML declaration.

  4. 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

YAMLXML
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 keysboth wrapped in <root>

How XML becomes YAML

XMLYAML
<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: no becomes <debug>false</debug>; under 1.2 it stays <debug>no</debug>.

FAQ

Frequently asked questions

How do I create XML attributes from YAML?

Start the key with @ 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?

An XML document must have exactly one top-level element. If your YAML has one top-level key, that key becomes the root. With several keys, a list or several documents, a <root> element is added — rename it under Options.

Is it safe to convert private configuration files?

Yes. Everything runs in your browser. The YAML and XML you paste or open are never uploaded or stored.

Why are some values quoted in the YAML?

Values such as 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?

XML has no equivalent, so every alias (*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?

An element becomes a list only when it repeats. Turn on Always use lists so the structure is the same for one item or many.

Does it work with pom.xml, RSS or SVG files?

Yes — any well-formed XML. Use Remove namespace prefixes for shorter keys, or Ignore attributes when you only need the elements.

Keep going

Browse every tool

Last updated Report a problem or suggest a feature