Tools

Home
JSON FormatterSQL FormatterJS ValidatorMinify CSS
Merge PDFCompress PDFImage to PDF
JPG to PNGPNG to WebPCrop Image

Change XML to CSV

Paste XML data and instantly extract records into CSV format with headers from tag names

Your files never leave your browser
XML Input0 chars, 0 lines
CSV Output0 chars, 0 lines
Error:
    Ready·

    Paste XML data, hit Convert, and get a clean CSV with tag names as column headers — no scripting, no imports, no sign-up. The tool detects repeating elements automatically, handles missing fields with empty cells, and quotes values that contain commas or special characters per RFC 4180. And everything runs in your browser. Nothing gets uploaded.

    How It Works

    Paste XML
    →
    Parse & Extract Records
    →
    Download CSV

    The parser scans your XML for the root element, then identifies which child tag repeats most — those are your records. Each record's immediate children become columns, with tag names as headers. If some records have extra fields that others don't, no problem: those cells just stay empty. Values with commas or quotes get escaped following the CSV standard so nothing breaks when you open the file.

    Examples

    Product Catalog Export

    An e-commerce platform dumps product data as XML. You need it in a spreadsheet for pricing review.

    INPUT
    <catalog> <product> <sku>WH-1000</sku> <name>Headphones</name> <price>299.99</price> </product> <product> <sku>SP-500</sku> <name>Speaker</name> <price>149.50</price> </product> </catalog>
    OUTPUT
    sku,name,price WH-1000,Headphones,299.99 SP-500,Speaker,149.50

    Employee Records with Missing Fields

    HR exported staff data but not every record has a phone number. The converter fills gaps with empty cells.

    INPUT
    <staff> <employee> <name>Sarah Chen</name> <dept>Engineering</dept> <phone>555-0142</phone> </employee> <employee> <name>James Okafor</name> <dept>Marketing</dept> </employee> </staff>
    OUTPUT
    name,dept,phone Sarah Chen,Engineering,555-0142 James Okafor,Marketing,

    Values with Commas and Quotes

    Tricky one. Some values contain commas or quotation marks that would break a naive CSV split.

    INPUT
    <items> <item> <desc>Cable, USB-C</desc> <note>Called "premium"</note> </item> </items>
    OUTPUT
    desc,note "Cable, USB-C","Called ""premium"""

    Who Uses This

    👨‍💻 Developers

    Converting SOAP or REST XML responses into flat files for database imports or quick debugging.

    📊 Data Analysts

    Pulling XML exports from legacy systems into CSV so they can work with the data in Excel or pandas.

    🏢 Project Managers

    Turning XML reports from enterprise tools into spreadsheets for stakeholder reviews.

    🔧 QA Engineers

    Comparing XML test output against expected CSV baselines without writing throwaway scripts.

    Common Mistakes

    Pasting XML with no repeating elements

    If your XML has a single record or all unique tag names with no siblings, there's nothing to turn into rows. The tool looks for repeated child elements under the root. Make sure your XML actually contains a list of similar items.

    Including malformed XML declarations

    The <?xml version="1.0"?> header is fine — the parser ignores it. But malformed declarations (missing closing ?>) or broken DOCTYPE lines will cause a parse error. If you get a blank output, check the first line of your paste.

    Expecting deeply nested data to flatten automatically

    This tool reads the immediate children of each record element. If you have three levels of nesting like <address><street><line1>...</line1></street></address>, the converter grabs all the text content but won't split nested tags into separate columns. Flatten your XML first if you need that level of detail.

    Technical Details

    Frequently Asked Questions

    How do I convert XML to CSV format?

    Paste your XML into the input box and hit Convert. The tool scans for repeating elements, turns each one into a row, and uses the tag names as column headers. You can copy the result or download it as a .csv file. No sign-up, no installs.

    What happens when XML records have different fields?

    The converter collects every unique tag name across all records and builds headers from those. If a specific record doesn't have a particular field, that cell is left blank. So you won't lose data — the CSV just has empty spots where the XML had nothing.

    Can I convert large XML files to CSV?

    Yes, but it depends on your browser and machine. Files under 10 MB convert quickly with no issues. Larger files work too, though your browser may slow down. For really massive datasets (50 MB+), a command-line tool or scripting language is a better choice.

    Does this tool handle XML namespaces?

    The DOMParser reads namespace-prefixed tags, but column headers will use the local tag name. If your XML has prefixes like <ns:field>, the header becomes "field" without the prefix. For most use cases this is exactly what you want.

    Is my XML data safe when using this tool?

    Completely. The conversion runs in your browser using JavaScript — nothing gets sent to a server. Your data stays on your machine the entire time. Refresh or close the page and it is wiped from memory.

    Share: