convert-csv.com logo convert-csv.com

Convert XML to CSV / Excel

Convert XML documents to CSV or Excel by flattening elements and attributes into columns.

100% Secure - your files are processed in your browser and never sent to a server.
Drop your file hereor click to browseSupports XML or TXT files (.xml, .txt) (Max 100MB)

XML (eXtensible Markup Language) is a versatile markup format used in data exchange, configuration files, and web services (SOAP, RSS, SVG). Converting XML to CSV requires flattening the hierarchical tree structure into rows and columns, which is complicated by XML's support for attributes, nested elements, mixed content, and namespaces. This converter parses XML documents using the browser DOMParser API and flattens elements into CSV rows. You can configure whether to include XML attributes as columns, set the output delimiter, and choose whether the first row contains headers. The tool handles deeply nested XML by using dot-notation for element paths (e.g., "person.address.city"). Repeating elements (sibling elements with the same tag name) are converted to separate rows, while unique child elements become columns. All parsing happens locally in your browser, making it safe for processing sensitive XML data like financial feeds, medical records (HL7/FHIR), or enterprise data exports. The tool supports XML files up to 100 MB.

How to use the Convert XML to CSV tool

  1. Load your XML data: Drag and drop your .xml file, choose a file from your file explorer, or paste XML content directly into the paste area.
  2. Configure output settings: Toggle whether to ignore XML attributes, choose a CSV delimiter (comma, semicolon, tab, or pipe), and set whether the first row is a header.
  3. Convert to CSV: Click the "Convert Data" button to flatten XML elements and attributes into CSV columns.
  4. Export results: Copy the results to your clipboard, download as a local file, or export to Excel format.

Frequently asked questions

Does this tool handle XML attributes as well as element content?
Yes. You can toggle whether to include XML attributes as columns. Attributes are prefixed with "@" (e.g., "@id") to distinguish them from element columns.
How does the tool handle deeply nested XML structures?
Nested elements are flattened using dot-notation paths. For example, <person><address><city>NYC</city></address></person> becomes a column "person.address.city" with value "NYC".
Can I convert XML with repeated elements (arrays)?
Yes. When the same element tag appears multiple times under a parent, each instance becomes a separate CSV row. Child elements that do not repeat become columns with values filled for each row.
Does it handle XML namespaces?
The parser extracts element content regardless of namespace prefixes. Namespace URIs are not included in column names, keeping the CSV output clean.
Is the output properly formatted CSV?
Yes. The output follows RFC 4180 format with proper quoting, escaping, and delimiter handling. It is compatible with all standard CSV readers, databases, and spreadsheet applications.

Related tools