SQL to XML Converter
Paste SQL INSERT statements and get well-formed XML with configurable root and row element names, NULL handled as `xsi:nil`, and proper escaping.
Last updated: May 27, 2026
Find this tool useful? Support the project to keep it free!
Buy me a coffeeWhat is SQL to XML Converter?
Many legacy and enterprise systems still consume XML. Migrating data out of a SQL system into one of those consumers usually means converting INSERT statements to XML — a tedious task when done by hand.
This tool parses INSERT statements with a real SQL tokenizer and emits well-formed XML. The root element defaults to the table name (overridable), and each row becomes an element you can name (default `<row>`). Column values become child elements with the column name. NULL values render as `<col xsi:nil="true"/>` instead of empty elements, which most XML consumers treat as "missing" rather than "empty string". Special characters in element names are sanitized.
How to Use SQL to XML Converter
Paste one or more SQL INSERT statements.
Optionally override the root element (default: table name).
Set the row element name (default: row).
Pick indent and toggle the XML declaration.
Copy the XML output.
Common Use Cases
- Converting a SQL export to XML for a legacy ESB or SOAP service.
- Producing XML fixtures from a SQL dump.
- Migrating data into XML-based file formats.
- Quickly inspecting a SQL INSERT as XML for debugging.
Example Input and Output
A SQL INSERT becomes XML with table name as root and row as row element.
INSERT INTO users (id, name) VALUES (1, 'Alice');<?xml version="1.0" encoding="UTF-8"?>
<users>
<row>
<id>1</id>
<name>Alice</name>
</row>
</users>Privacy
All parsing happens in your browser. No SQL is sent to a server.
XML namespaces
The output uses xsi:nil for NULL values but does not declare the xsi namespace. Add xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" to the root element if your consumer is strict about namespaces.

