TXT to XML Converter
A text file with one record per line is easy to write and hard to import into systems that expect tagged data. Upload the .txt and get well-formed XML with one element per line and the header names as tags.
Data Converter
or drop CSV, TSV, TXT … files here ·
Max 95 MB per file· Up to 20 files· Deleted after 30 minutes
Files are processed on our servers and deleted after 30 minutes.
Character that separates columns in CSV and text files, for both reading and writing. Auto detects it from the input and writes commas.
UTF-8 works for every language. Choose UTF-8 with BOM if Excel on Windows shows garbled accents or Asian characters when opening the CSV.
Excel, ODS and Numbers input: convert the first sheet only, or every sheet (one CSV per sheet in a ZIP, or one JSON key per sheet).
Name of the sheet tab in the new spreadsheet, up to 31 characters.
Array of objects uses column names as keys for every row; array of arrays is more compact and keeps the header as the first array.
Name of the outer element that wraps all rows; each row becomes a <row> inside it.
Used in CREATE TABLE and INSERT statements. Letters, digits and underscores only.
Quoting and column types differ slightly between databases; pick the one you will import into.
Rewrite date cells in one format. ISO (2026-10-18) is safest for databases and code; keep leaves them as they appear in the source.
How to use this tool
- 1
Upload the delimited text
Add a .txt file whose first line names the columns, or up to 20 files of 95 MB each. Delimiter is on Auto detect.
- 2
Name the outer element
Under Advanced settings, XML root tag is set to records on this page. Change it to whatever the receiving system expects, such as products or employees.
- 3
Convert to XML
Press Convert to XML. Pretty print is on, so the file is indented and easy to check in any text editor or browser.
Each line of the text file becomes one row element, each column becomes a tag named after its header, and everything sits inside the root tag you choose.
Why turn a TXT file into XML
Text files with separators are what scripts, scanners and older databases produce by default. XML is what many receiving systems were designed around: product catalogs, library and publishing tools, translation software and configuration loaders that read elements by name. XML 1.0 became a W3C Recommendation in February 1998 as a simplified form of SGML, and a great deal of enterprise software from the years that followed still speaks it.
The gap between the two is mostly mechanical, which is why doing it by hand in a text editor is a waste of an afternoon. Typical jobs are a warehouse export that has to become an XML import for a web shop, a list of glossary terms for a translation tool, or test records for an application that reads XML fixtures. When the source is already comma-separated, CSV to XML is the matching page.
Text layouts the TXT to XML converter can split
| from ↓ · to → | XML | JSON | CSV |
|---|---|---|---|
| Comma , | Comma , to XML: yes | Comma , to JSON: yes | Comma , to CSV: yes |
| Semicolon ; | Semicolon ; to XML: yes | Semicolon ; to JSON: yes | Semicolon ; to CSV: yes |
| Tab | Tab to XML: yes | Tab to JSON: yes | Tab to CSV: yes |
| Pipe | | Pipe | to XML: yes | Pipe | to JSON: yes | Pipe | to CSV: yes |
| Single space | Single space to XML: yes | Single space to JSON: yes | Single space to CSV: yes |
| Fixed-width columns | – Fixed-width columns to XML: no | – Fixed-width columns to JSON: no | – Fixed-width columns to CSV: no |
TXT to XML example output
<records>
<row>
<sku>A-1001</sku>
<name>Desk lamp</name>
<price>24.90</price>
</row>
</records>Because header names turn into tags, they have to be valid XML names: start with a letter or underscore and avoid spaces and symbols. A header like Unit Price is better written as unit_price before converting. If the receiving system prefers JSON after all, TXT to JSON uses the same header line as keys, and the data converter lists every other target.
Plain text and XML format facts
TXT
Plain text
A TXT file contains only plain characters with no formatting, fonts, images or layout. Modern text files are usually encoded in UTF-8, which covers every language, though older files may use other encodings and show garbled characters. Plain text is tiny, never becomes obsolete and opens on every device, from phones to servers. It cannot hold bold text, tables or pictures, so structure must be expressed with spacing or simple markup.
- Compression
- –
- Transparency
- –
- Animation
- –
- Introduced
- –
XML
Extensible Markup Language
XML is a markup language for structured data published by the W3C in 1998. It uses nested tags with attributes and supports schemas, namespaces and validation, which makes it robust for complex documents. It underlies RSS feeds, SVG, Office documents, sitemaps and many enterprise and government data exchanges. XML is verbose compared with JSON, but every programming language and many spreadsheet tools can read it.
- Compression
- –
- Transparency
- –
- Animation
- –
- Introduced
- 1998 · W3C
Delimited text becomes XML when a flat export has to enter a system that only takes tagged records: a CMS or shop import, a configuration loader, or an integration whose other side was built around XML long before JSON.
TXT to XML questions
Does my text file need a header line?
It should have one, because the header names become the element names around every value. If your export starts straight with data, add a line such as sku|name|price at the top in a text editor before converting.
Can I rename the outer element from records?
Yes. XML root tag accepts up to 64 characters starting with a letter or underscore, followed by letters, digits, dots, hyphens or underscores. Each line of the text file is written as a row element inside it.
What happens to & and < characters inside my values?
They are escaped as & and <, as the XML specification requires, so a company name like Smith & Sons does not break the file. Any XML parser turns them back into the original characters when it reads the data.
Why is the XML so much larger than the text file?
Every value is wrapped in an opening and a closing tag that repeats the column name, and Pretty print adds indentation on top. A file several times the size of the source is normal. Turn Pretty print off for a compact version.
Can the values be written as attributes instead of child elements?
No. The converter writes each value as its own child element, the layout most import tools accept. If a partner specifically needs attributes, an XSLT stylesheet can reshape the converted file in one pass.
My file comes from an old Windows program. Will accented names survive?
Set Text encoding to Windows-1252 before converting, since many older Windows programs wrote that code page instead of UTF-8. If the names still look wrong, try ISO-8859-1, the other common Western code page.