GALAXY OF TOOLS

DEV SECTOR

XML to YAML Converter

Convert XML to clean YAML with typed values, @attributes, lists and optional multi-document output.

Swap: YAML → XML

Runs entirely in your browser. Nothing you enter or upload is sent to a server.

Convert XML to YAML for readable configuration

The XML to YAML converter turns XML — Maven and Spring configuration, .NET app.config files, Android resources, SOAP payloads, RSS feeds and data exports — into clean, indented YAML that is easier to read, to review in a pull request and to use with Kubernetes, Ansible, GitHub Actions and other YAML-based tools.

Attributes become @name keys, element text sits under #text when an element also has attributes, and repeated elements become YAML lists. “Convert numbers & booleans” is on by default, so <replicas>3</replicas> becomes replicas: 3, while text such as 007 stays a quoted string. You can also write every child of the root element as its own YAML document.

Your browser checks the XML and the open-source js-yaml library (MIT licence) writes the YAML, all on your device. Nothing is uploaded.

How to use the XML to YAML Converter

  1. Paste XML into XML input, drop a file onto the box or press Open file.
  2. Choose how Attributes appear, the Text node key, and when Arrays are created.
  3. Keep or untick Convert numbers & booleans, and decide about namespaces, CDATA, comments and element order.
  4. Pick a 2- or 4-space indent and, if you want, tick “Each child of the root → its own YAML document”.
  5. Press Copy or Download YAML. Swap sends the YAML to the YAML to XML converter for a round-trip check.

XML to YAML Converter features

Typed, safe values

Numbers and true/false become real YAML values. Strings that a YAML reader could misinterpret — 007, yes, null, 1e3 — are quoted, so every value reads back exactly as it was in the XML.

Readable block style

Nested mappings, lists with -, 2- or 4-space indentation, no line folding, and multi-line text written as a literal | block.

Multi-document output

Split a document whose root holds many records — services, jobs, users — into separate --- YAML documents, as Kubernetes manifests do.

Attributes and namespaces

Attributes keep a prefix you choose or go into an _attributes map; namespace prefixes are kept with their xmlns declarations or stripped.

Order and mixed content

With “Preserve element order”, mixed text and elements become an ordered list, so documents like <p>Hi <b>there</b>!</p> lose nothing.

Errors located

Mismatched tags, undefined entities and stray & characters are reported with the line and column before any YAML is written.

XML and YAML side by side

@ and # are reserved characters at the start of a YAML key, so '@name' and '#text' are always quoted. Prefer unquoted keys? Set the attribute prefix to _. XML comments can be kept as #comment values, but they are not turned into YAML # comments.

XMLYAML
<replicas>3</replicas>replicas: 3
<service name="api">service: with '@name': api inside
<port>80</port><port>443</port>port: followed by - 80 and - 443
<env name="CURRENCY">₹</env>'@name': CURRENCY and '#text': ₹
<owner/>owner: ''
Text spanning two linesnote: |- followed by both lines

What to expect when migrating configuration

Prefer JSON? XML to JSON uses the same conventions, and the YAML ↔ JSON Converter moves between the two text formats.

  • The structure is mapped one to one. The converter does not know what a framework means by an element: Spring <bean> definitions do not turn into Spring Boot properties, and a pom.xml does not become a Gradle file. You get the same data in YAML form, ready to rearrange.
  • Lists of one. An element that appears once becomes a single value, not a list. List names such as dependency, server under “For the names I list” to keep them as lists.
  • Identifiers stay text. Untick “Convert numbers & booleans” for files full of version numbers, PIN codes or account IDs if you want every value as a string.
  • Check the result. Press Swap to rebuild XML from the YAML and compare it with the original in the XML Formatter.

XML to YAML Converter FAQ

How do I convert XML to YAML?

Paste the XML or open the file. The XML to YAML conversion appears on the right straight away; adjust the options if needed, then copy the YAML or download it as a .yaml file.

How are XML attributes written in YAML?

As keys with a prefix, '@name': api by default, inside the element’s mapping. You can use another prefix, group them in an _attributes map or leave attributes out.

Why are some values in quotes?

Quotes keep a string a string. Without them a YAML reader would turn 007 into 7, yes into true in older tools, or 1e3 into 1000. Untyped values are quoted for the same reason when number conversion is off.

Can it produce several YAML documents?

Yes. Tick “Each child of the root → its own YAML document” and every child element of the root is written as a separate document separated by ---. Attributes of the root itself are left out in that mode.

Can I convert the YAML back to XML?

Yes — press Swap to open it in the YAML to XML converter with the same attribute and text settings and all documents placed under one root element.

Is my XML uploaded?

No. The file is parsed by your browser and the YAML is generated locally with js-yaml, so configuration secrets stay on your device.

You might also need