Text

or drop a file here, or paste code below
Read the text as

No input yet.

XML

XML output

Files never leave your browserHow?

Plain text to well-formed XML

This converter turns plain text into well-formed XML. Each line can become an element, a table with a header row becomes one record per row, and key = value lines become tags – with element names you choose.

Last updated:

How it works

  1. Paste the text

    Paste lines, a tab- or comma-separated table, or key = value settings, or open a .txt file.

  2. Name the elements

    Set the root, row and line element names, and choose child elements or attributes for the columns.

  3. Download the XML

    Copy the XML or download a .xml file with or without the XML declaration.

Features

  • Valid names, always

    Column headers like "first name" or "2024" are turned into valid element names (first_name, _2024); reserved xml… names are prefixed.

  • Correct escaping

    &, < and > are escaped, attribute quotes too, and characters that XML 1.0 forbids are removed, so the output always parses.

  • Elements or attributes

    <row><city>Lisbon</city></row> or <row city="Lisbon"/> – pick the shape your importer expects.

  • CDATA when needed

    Text with < or & can be written as a CDATA section instead of entities, which keeps code and markup readable.

  • Nested settings

    INI [sections] and repeated keys become nested and repeated elements.

Limits & privacy

Text up to 20 MB; inputs over 256 KB are converted in a background worker. The output is UTF-8 XML 1.0. Nothing is uploaded. See the privacy page.

FAQ

How do I convert a text file to XML?

Paste the text or open the file, check the structure (auto-detected) and download the XML.

How do I make each line an XML element?

Choose one item per line and set the line element name, for example <item>. The root element wraps all of them.

Can table columns become attributes?

Yes. With a header row, choose Columns as: Attributes to get one empty element per row with an attribute per column.

Why are some names changed?

XML names cannot start with a digit or contain spaces. Such names get an underscore so the document stays well-formed.

Is the output indented?

By default with 2 spaces. Choose 4 spaces, tabs or minified XML in the output options.

Related tools