Back to Tools

XML to Text Converter

Extract and clean text content from XML structures

0
Input XML

Keep the words, drop the markup

XML wraps content in tags that are useful to software but distracting to people. This tool parses pasted XML and returns only the text inside it. You can take the entire document or restrict the output to one element name, such as title or email, which is handy for pulling a single field out of a long file.

How to extract text

  1. Paste XML into Input XML. Sample loads a small users list, and the character count in the header updates as you type.
  2. Choose Extract All Text or Specific Tag Only. For the second option, type the element name in the Tag Name box; the match is case-sensitive.
  3. Set Clean Whitespace to trim each line and remove blank ones, and New line per tag to put each piece of text on its own line.
  4. Press Extract Text. Read the result and use Copy or the .txt button, which saves extracted_text.txt.

The summary line states how many lines were produced. If the XML is malformed, an Invalid XML dialog appears instead.

The second button: Extract JSON

Next to the main button is Extract JSON, which ignores the text options and instead converts the whole document to a JSON structure with two-space indentation. Attributes are collected under @attributes and text nodes appear as #text entries. The output is displayed in the same box and downloads as a .txt file, so rename it to .json if needed. For a more configurable XML to JSON conversion, use the dedicated tool.

Ways people use it

  • Pulling all the paragraph text out of an XML or XHTML export to proofread it.
  • Grabbing every value of one field, such as all email addresses, from a data file.
  • Checking what human-readable content a feed actually contains.
  • Feeding only the wording of a document into a word counter or translation tool.

Behavior worth knowing

Attribute values are not included in the text output, only element content. With New line per tag switched off and Extract All Text selected, the text of the document is joined as one block, so neighboring values may run together. Specific Tag Only with an empty Tag Name falls back to extracting everything. Tag matching returns the full text content of each match, including text from nested children.


Related Tools

Related Tools


Frequently Asked Questions

Is the tag name case-sensitive?
Yes. XML distinguishes uppercase and lowercase, so Title and title are different tags. Type the name exactly as it appears in your document, otherwise the result will be empty. Check for capitalization differences first if nothing appears.
Are attribute values included in the text?
No. The extraction returns only text content between tags. An attribute such as id="101" is not part of the output. If you need attributes, use the Extract JSON button or the XML to JSON converter.
What do Clean Whitespace and New line per tag do?
Clean Whitespace trims each line and deletes blank lines. New line per tag places each text node on its own line. Turning off the newline option with all text selected returns the document text as one continuous block.
What happens if I choose Specific Tag Only but leave Tag Name empty?
The tool falls back to extracting all text from the document. Enter an element name in the Tag Name field to limit the output to matches of that tag, which are listed in document order.
Why does the JSON export download as a .txt file?
Both buttons share the same output box and download button, which always saves extracted_text.txt. The content is valid JSON when you used Extract JSON, so you can simply rename the file with a .json extension. Open the file in any editor to review the content.
Support Chat
We typically reply within minutes

Hello! 👋 Before we start, please tell us your name.