Free online CSV to XML converter
Convert tabular CSV data into structured XML for systems that require named elements and schemas.
Convert CSV to XML online - free
Your file is processed instantly and never stored on our servers.
How to convert csv to xml file
- Text files
- No ratings yet.
A data-import system, device, or business application may require XML instead of a tabular CSV file. Conversion keeps the records while expressing their fields as named elements that software can process, validate, and exchange.
What the CSV format is
CSV (comma-separated values) stores rectangular data as rows and columns. Each line usually represents one record, and the first line may contain column names such as id,name,price.
Despite its name, a CSV file may use commas, semicolons, tabs, or another delimiter. Values containing the delimiter, line breaks, or quotation marks are normally enclosed in double quotes; an embedded double quote is represented by two consecutive double quotes. CSV conventions are not completely uniform, so the delimiter, quoting rules, line endings, and character encoding must be identified before conversion.
Spreadsheet applications such as Microsoft Excel and LibreOffice Calc export CSV files. Databases, accounting systems, contact managers, laboratory instruments, and scripts also use them. CSV is suitable for simple tables, but it does not natively describe nested records, attributes, data types, validation rules, or relationships between tables.
What the XML format is
XML (Extensible Markup Language) stores structured text using elements and attributes. A row for a customer can become a <customer> element containing child elements such as <id>, <name>, and <email>.
XML can represent hierarchy, repeated records, namespaces, comments, and validation rules defined by a schema such as XSD. These features support application interfaces, configuration files, document exchange, publishing systems, and archives that require an explicit structure. XML is usually more verbose than CSV, and a converter cannot infer business relationships or the recipient’s required schema from column names alone.
How to convert CSV files to XML
Using the built-in online converter
- Open the CSV-to-XML converter on 101convert.com.
- Select or upload the source
.csvfile. - Choose the delimiter used by the file, commonly comma, semicolon, or tab, and specify whether the first row contains column headers.
- Select UTF-8 when the data contains accented characters, non-Latin text, or symbols.
- Choose the XML structure if options are available. A common structure has one root element, one repeated record element, and one child element for each column.
- Start the conversion and download the resulting
.xmlfile.
Files can be converted on 101convert.com without installing software. Do not upload confidential, regulated, or personally identifiable data unless the service meets the applicable data-handling requirements.
Using Python
Python’s standard library can perform repeatable conversions without an additional package. This example reads a header row, uses a conservative mapping for XML element names, and writes UTF-8 XML:
import csv
import re
import xml.etree.ElementTree as ET
def xml_name(header, number):
name = re.sub(r"[^A-Za-z0-9_.-]", "_", header.strip())
if not name or not re.match(r"^[A-Za-z_]", name):
name = f"field_{number}"
return name
root = ET.Element("records")
with open("input.csv", newline="", encoding="utf-8-sig") as source:
reader = csv.DictReader(source, delimiter=",")
headers = [xml_name(h or "", i) for i, h in enumerate(reader.fieldnames or [], 1)]
for values in reader:
record = ET.SubElement(root, "record")
for number, (original, value) in enumerate(values.items(), 1):
field = ET.SubElement(record, headers[number - 1])
field.text = value or ""
ET.ElementTree(root).write("output.xml", encoding="utf-8", xml_declaration=True)
Save the script as csv_to_xml.py and run python csv_to_xml.py. Change delimiter="," for a semicolon- or tab-delimited file, and replace records and record with the names required by the receiving system. The script assumes unique headers; after name cleanup, duplicate headers must be renamed or mapped explicitly.
Compatibility and data-quality checks
- Map the structure to the destination schema. A well-formed XML file can still be rejected if it has the wrong root element, namespace, nesting, field order, required element, or data format. Use the recipient’s XSD or sample XML when available.
- Check XML element names. Header names cannot be used unchanged when they begin with a number or contain spaces and other prohibited characters. Rename them or configure an explicit mapping. Avoid converting arbitrary headers directly into XML tags without validation.
- Define data types explicitly. CSV does not reliably distinguish identifiers, numbers, dates, and Boolean values. Preserve values such as
00125as strings when leading zeroes matter, and specify decimal separators, date formats, and Boolean representations. - Decide how to represent empty fields. A missing element, an empty element such as
<email/>, and an empty attribute may have different meanings to the receiving application. - Verify encoding. UTF-8 is the usual choice. The XML declaration, such as
<?xml version="1.0" encoding="UTF-8"?>, must match the actual file encoding. - Preserve escaping. Ampersands, less-than signs, and other reserved characters must be escaped in XML. Libraries and correct converters handle this; manually concatenating XML strings can produce invalid documents.
- Check rows and values after conversion. Compare the record count, headers, representative quoted fields, line breaks, empty values, dates, decimal values, and non-ASCII characters with the source. Large files may also require a streaming converter rather than loading the entire dataset into memory.
CSV vs XML: format comparison
How the CSV and XML formats compare on the properties that matter most for this conversion.
| Property | .CSV Comma-Separated Values | .XML Extensible Markup Language |
|---|---|---|
| Plain-text readable | Yes | Yes |
| Data types | Typed | Typed |
| Nested structures | No | Yes |
| Formulas | No | No |
| Multiple tables or sheets | No | — |
| Typical file size | Small | Small |
| Open standard | Yes | Yes |
| Best used for | Data exchange | Data exchange |
| Introduced | — | 1998 |
| Developer | — | W3C |
| MIME type | text/csv | application/xml |
Suggested software and links: csv to xml converters
Frequently asked questions
Is the CSV to XML converter free?
Yes, converting CSV to XML on 101convert.com is completely free. No registration, email address or installation is required.
How large can my CSV file be?
You can upload CSV files up to 300 MB and convert up to 100 files at once in a single batch.
What happens to my uploaded files?
Files are processed automatically and deleted from our servers within a few minutes after conversion. We never view or share your files.
Do I need to install any software to convert CSV to XML?
No. The CSV to XML conversion runs entirely online in your browser and works on Windows, Mac, Linux, Android and iPhone.
Did the conversion fail?
In most cases, the cause is an incorrect file format. Please upload a valid CSV file for this CSV to XML conversion. Occasionally, the issue may be on our side. We analyze recurring conversion failures and disable or fix the converter if we detect a defect.