FormatterHQ

XML to Text Converter

Strip the tags and get a readable plain-text summary of any XML: numbered records, key: value lines and indented nesting, ready for an email or a ticket.

Input XML
Output TEXT
Ready.

How to use the XML to Text Converter

  1. Paste XML into the input editor, upload a file, use Load URL, or click Sample.
  2. Clear the Attribute prefix if you want attributes listed without the @ marker.
  3. Click Convert to Text.
  4. Copy the text or Download it as a .txt file.

What the XML to text converter produces

Sometimes you do not need another data format, just something a person can read. This XML to text converter removes the angle brackets and closing tags and writes the content as simple key: value lines, with indentation for nested elements. It is useful for pasting an API response into a support ticket, reading a configuration over a chat message, or giving a non-technical colleague a quick look at an export.

Example: a list of records

<catalog>
  <book id="bk101" lang="en">
    <author>Gambardella, Matthew</author>
    <title>XML Developer's Guide</title>
    <price>44.95</price>
  </book>
  <book id="bk102" lang="en">
    <author>Ralls, Kim</author>
    <title>Midnight Rain</title>
    <price>5.95</price>
  </book>
</catalog>
#1
  @id: bk101
  @lang: en
  author: Gambardella, Matthew
  title: XML Developer's Guide
  price: 44.95

#2
  @id: bk102
  @lang: en
  author: Ralls, Kim
  title: Midnight Rain
  price: 5.95

Top-level records are numbered and separated by a blank line. The <catalog> wrapper is skipped because it only holds the list.

Example: nested data without attribute markers

With the Attribute prefix field cleared:

<profile id="7">
  <name>Ava</name>
  <address><city>Denver</city><zip>80202</zip></address>
  <tags><tag>admin</tag><tag>beta</tag></tags>
</profile>
name: Ava
address:
  city: Denver
  zip: 80202
tags:
  tag: admin, beta
id: 7

Nested elements are indented under their parent, and repeated simple values are joined with commas on one line. Without a prefix, attributes are listed after the child elements.

When plain text is the right choice

Plain text survives every channel: it pastes cleanly into chat apps, issue trackers, emails and terminal notes without any rendering, and screen readers handle it well. It also hides the parts of XML that distract non-technical readers, such as namespaces, closing tags and entity escapes, while keeping every value visible. For a quick sanity check of an export, reading the text version is often faster than scanning the raw XML.

Good to know

  • This is a readable summary, not a reversible format. Use XML to JSON or XML to YAML if the result must be parsed again.
  • Comments and the XML declaration are omitted; CDATA content appears as plain text.
  • For HTML pages rather than XML data, the HTML to text tool is the better fit.

Tips for long exports

  • Trim first. For a ticket or an email, a handful of records is usually enough. Cut the XML down to the records that matter, keeping the wrapper element, and convert only those.
  • Keep the prefix when names clash. In <item id="1"><id>A7</id></item> an attribute and a child element share a name. With the default @ prefix they appear as @id: 1 and id: A7; without it, both lines read id.
  • Attach rather than paste. Some chat and ticket systems trim leading spaces, which flattens the indentation. Use Download and attach the .txt file when the nesting matters.

Privacy

The text is produced in your browser and the XML is not uploaded, except when you choose Load URL or Save & Share.

Convert XML to text in Python

To get the plain text out of XML, parse it with xml.etree.ElementTree and call itertext(), which walks every text node in document order. The mistake to avoid is reading element.text: it only holds the text before the first child element, so for an element that contains other elements it is None or a fragment. Entities such as &amp; are decoded for you, and " ".join(text.split()) collapses the whitespace left over from indentation.

import xml.etree.ElementTree as ET

data = """<note id="7">
  <to>Ann</to>
  <body><p>Meet at noon.</p><p>Bring tea &amp; cake.</p></body>
</note>"""
root = ET.fromstring(data)
body = root.find("body")

print(repr(body.text))                 # None: .text stops at the first child
print(" ".join(body.itertext()))       # every text node below <body>

# the whole document, with runs of whitespace collapsed
print(" ".join(" ".join(root.itertext()).split()))

For a labelled key: value view of the same document, paste it into the converter above.

Frequently asked questions

How do I remove the @ signs from the text?
Clear the Attribute prefix option. Attributes are then printed like ordinary fields, after the child elements.
Can I convert the text back to XML?
Not reliably. The plain-text layout is meant for people. Convert to JSON or YAML instead if you need a format that can be converted back.
What does Detect numbers & booleans change here?
Very little, since everything is printed as text. It mainly affects how values like 44.95 or true would be typed in other output formats.
Does it keep the order of elements?
Yes, elements are printed in document order, except that repeated elements with the same name are grouped together under one key.

Last updated October 3, 2026

Related tools

HTML to Text Converter Extract readable plain text from HTML: keeps paragraphs, headings, lists and tables, drops tags, scripts and styles. Image to Text (OCR) Extract text from images, screenshots and scanned PDFs with OCR in 28 languages. Edit, copy or download it, or make a searchable PDF. No upload. JSON to Text Converter Convert JSON to Text online for free. Readable key: value output for reports and tickets. PDF to Text Converter Extract all the text from a PDF, page by page, as plain text you can copy or download as .txt. Choose pages; works in your browser. Text to HTML Converter Paste formatted text from Word, Google Docs or a web page, or type plain text, and get clean HTML code. Removes inline styles, classes and Word markup. Text to Speech Read text aloud with the voices in your browser. Choose a voice and language, set speed, pitch and volume, and follow the highlighted words. XML to TSV Converter Convert XML to TSV online for free. Paste the result straight into a spreadsheet. XML to YAML Converter Convert XML to YAML online for free. Clean, readable YAML with configurable indentation. YAML Converter Convert YAML to JSON, XML, CSV, TOML or an HTML table in one place. Anchors, aliases and multi-document files supported. YAML to CSV Converter Convert YAML to CSV online for free. Nested data is flattened into columns. YAML to Excel Converter Convert YAML to Excel online for free. Download a real .xlsx workbook generated in your browser. YAML to JSON Converter Convert YAML to JSON online for free. Get formatted JSON with types detected automatically.