TXT to XML Converter
Wrap every line of plain text in an XML element to produce a well-formed document — each line becomes a child tag, surrounded by a configurable root element, with special characters such as &, <, and > automatically escaped. Customize both the root tag name and the per-item tag name, and toggle pretty-print for indented output or compact single-line XML. Results update instantly as you type, with no server involved and no signup required.
Plain Text
Root Element
Item Element
Options
XML
What is Plain Text to XML Converter?
Content migration, configuration conversion, and data enrichment pipelines often need to add XML structure to plain text. A word list becomes a vocabulary element set. A key=value config file becomes an XML configuration document. A line-by-line address list becomes a structured postal data feed. This tool wraps text content in XML markup without requiring you to write the XML by hand: each line becomes an element with a configurable tag name, key=value lines are split at the separator with the key becoming the element name, and special characters (<, >, &, ", ') are entity-encoded automatically to ensure well-formed output. Set the root element name and item element name to produce semantically descriptive XML rather than generic wrapper tags. Enable line index attributes to add id="1", id="2" numbering to each element.
How to Use
- 1
Paste or Upload Your Text
Paste plain text or upload a .txt file. The tool can convert line-by-line lists, key=value files, delimiter-separated text, and arbitrary text blocks wrapped in custom tags.
- 2
Configure XML Wrapping
Set the root element name (default: "root"), the element name for each line or record (default: "item"), and choose whether to use an attribute (id="1") or child element for line indexing.
- 3
Convert to XML
Click "Convert to XML". Each text line becomes an XML element; key=value lines are split into key-named elements; special XML characters (<, >, &, ", ') are entity-encoded automatically.
- 4
Copy or Download the XML
Copy the XML for use in a content pipeline, configuration system, or XML-based import tool — or download it as a .xml file.
Common Use Cases
Content Migration to XML Systems
Wrap plain-text content lines or paragraphs in XML tags for migration to CMS platforms, publishing systems, or data pipelines that require XML-structured content input.
Configuration File Creation
Convert simple key=value plain-text configuration into XML format for systems that require XML configuration files, such as Maven, Ant, Spring XML, or legacy enterprise software.
Word List & Dictionary XML
Convert plain-text word lists or glossaries into XML dictionaries for use in spell-checkers, NLP preprocessing pipelines, or Android/iOS app string resource files.
Email & Notification Template Wrapping
Wrap plain-text email content in XML markup for templating systems, mail merge pipelines, or XML-based notification frameworks that separate content from presentation structure.
Conversion Examples
Text Lines → XML Elements
Each text line is wrapped in a repeating XML element under a root node.
Input JSON
apple banana cherry date
Output CSV
<?xml version="1.0" encoding="UTF-8"?> <root> <item>apple</item> <item>banana</item> <item>cherry</item> <item>date</item> </root>
Key=Value Text → XML Config
Lines in key=value format become XML elements with the key as the tag name.
Input JSON
host=localhost port=8080 debug=true max_connections=100
Output CSV
<?xml version="1.0" encoding="UTF-8"?> <config> <host>localhost</host> <port>8080</port> <debug>true</debug> <max_connections>100</max_connections> </config>