Convert INI to XML
Convert INI settings into usable XML while checking syntax, encoding, and target schema limits.
Convert INI files online
We don’t have a dedicated online converter for INI to XML yet, but you can convert INI files online to these formats:
Want to convert INI to XML?
Let us know. We pick the conversions to add next by how many people ask for them.
How to convert ini to xml file
- Other formats
- No ratings yet.
A program, device utility, or configuration-management system may require XML when the original settings are stored in INI format. Converting the file allows the settings to be imported, validated against an XML schema, or exchanged with software that cannot read INI.
What the INI format is
INI is a plain-text configuration format built from sections and key-value pairs, such as timeout=30 under [network]. It is common in Windows applications, legacy desktop software, games, installers, development tools, and vendor-specific device utilities.
INI has no universal specification. Programs differ in their comment characters, delimiters, quoting, interpolation, duplicate-key behavior, case sensitivity, multiline values, and support for arrays or nested data. A file that is valid for one application may not be valid for another.
What the XML format is
XML represents data with nested elements, attributes, text values, closing tags, and defined escaping rules. It can be accompanied by namespaces and an external XSD schema for structure and data-type validation; XML does not validate itself automatically.
XML suits applications that require a defined hierarchy, namespaces, schema validation, or standardized data exchange. It is usually more verbose than INI, so conversion normally increases file size rather than reducing it.
How to convert INI to XML
For a local conversion, Python's standard-library configparser and xml.etree.ElementTree provide a repeatable option without uploading credentials, API keys, hostnames, or device settings. This script creates a general XML representation; it does not guess the XML schema required by a particular application.
- Install Python 3 from
python.orgif it is not already available. - Save the following code as
ini_to_xml.py:
import configparser
import sys
import xml.etree.ElementTree as ET
source, target = sys.argv[1:3]
config = configparser.ConfigParser(
interpolation=None,
strict=False,
empty_lines_in_values=False
)
config.optionxform = str
with open(source, encoding="utf-8") as file:
config.read_file(file)
root = ET.Element("configuration")
def add_section(parent, name, values):
section = ET.SubElement(parent, "section", {"name": name})
for key, value in values.items():
entry = ET.SubElement(section, "entry", {"name": key})
entry.text = value
if config.defaults():
add_section(root, "DEFAULT", config.defaults())
for section_name in config.sections():
# _sections contains values written in this section, excluding DEFAULT values.
values = {
key: value
for key, value in config._sections[section_name].items()
if key != "__name__"
}
add_section(root, section_name, values)
ET.indent(root, space=" ")
ET.ElementTree(root).write(target, encoding="utf-8", xml_declaration=True)
- Run it from a terminal:
python ini_to_xml.py settings.ini settings.xml
For an input containing [network] and timeout=30, the output includes:
<configuration>
<section name="network">
<entry name="timeout">30</entry>
</section>
</configuration>
The generic structure uses section and key names as attribute values, so names that are not valid XML element names can still be represented. If the receiving application requires a specific root element, child elements, attributes, namespace, or schema, change the script to generate that structure instead of importing this output unchanged.
Desktop and online options
For occasional manual conversion, use Notepad++ or another plain-text editor to map each INI section and key into the XML structure required by the target program. Oxygen XML Editor and similar desktop XML editors can format, edit, and validate the resulting XML, but they do not provide a universal INI import because INI has no consistent data model.
An online converter is suitable only for a simple, non-sensitive file. Use a reputable service only when its current format list explicitly accepts INI input and produces XML output; generic document converters may reject INI or treat it as unstructured text. Do not upload passwords, private keys, API credentials, proprietary settings, or device configuration. Downloaded XML should be checked locally before use.
Quality and compatibility limits
The script preserves section names and parsed values, but it does not preserve comments, original spacing, formatting, or application-specific syntax. It also does not reproduce the behavior of interpolation, environment-variable expansion, conditional settings, or custom array and nested-value conventions.
strict=False allows duplicate keys during parsing, but only the last value is retained. Remove that option when duplicate keys should cause an error. interpolation=None copies percent sequences literally instead of treating them as references. The default parser also expects supported delimiters and rejects some INI dialects, including bare keys unless allow_no_value=True is configured.
The example reads UTF-8 and writes UTF-8 with an XML declaration. Identify the original program's character encoding before conversion; older Windows software may use a code page such as Windows-1252. Invalid XML control characters cannot be written, and values with XML-sensitive characters are escaped by ElementTree.
Validate the result with the target application's importer or its XSD, then test the settings in a non-production environment. A syntactically valid XML file can still be incompatible with the receiving program's required names, types, defaults, ordering, or namespace.
INI vs XML: format comparison
How the INI and XML formats compare on the properties that matter most for this conversion.
| Property | .INI INI file | .XML Extensible Markup Language |
|---|---|---|
| Open standard | — | Yes |
| Compression | Uncompressed | Uncompressed |
| Typical file size | Very small | Small |
| Opens in a web browser | No | Yes, natively |
| Further editing | Easy | Easy |
| Metadata support | Basic | Basic |
| Plain-text readable | Yes | Yes |
| Best used for | Data exchange | Data exchange |
| Introduced | — | 1998 |
| Developer | — | W3C |
| MIME type | — | application/xml |
Information about file extensions and file types is provided by File-Extensions.org
Suggested software and links: ini to xml converters
Additional formats for
ini file conversion
Reverse conversion
Convert to xml from
other formats
- xfdf to xml
- sldasm to xml
- enw to xml
- xlmx to xml
- cdfx to xml
- pkt to xml
- dwg to xml
- roz to xml
- rpt to xml
- jpeg to xml
- 123 to xml
- abs to xml
- accdt to xml
- acp to xml
- adp to xml
- ascii to xml
- asm to xml
- ass to xml
- atomsvc to xml
- bgl to xml
- cap to xml
- catpart to xml
- catproduct to xml
- cgr to xml
- crtx to xml
- crypt12 to xml
- dex to xml
- dxi to xml
- ecsv to xml
- edi to xml
- enc to xml
- ets to xml
- excel to xml
- exp to xml
- fm to xml
- fods to xml
- fp to xml
- fp4 to xml
- fr3 to xml
- iam to xml
- iges to xml
- ipd to xml
- ipt to xml
- iqy to xml
- jpg to xml
- lin to xml
- ll to xml
- lng to xml
- m3u8 to xml
- mar to xml
- mdt to xml
- mdwn to xml
- model to xml
- mst to xml
- mu3 to xml
- myr to xml
- nbib to xml
- nfo to xml
- odc to xml
- ove to xml
- png to xml
- prt to xml
- ps to xml
- qrp to xml
- ris to xml
- s2db to xml
- sba to xml
- sdf to xml
- sl2 to xml
- sl3 to xml
- sldprt to xml
- sqlite2 to xml
- srt to xml
- stm to xml
- stp to xml
- sxc to xml
- tdl to xml
- thmx to xml
- tif to xml
- tiff to xml
- trc to xml
- usr to xml
- vda to xml
- wk1 to xml
- wk3 to xml
- wks to xml
- x_t to xml
- xdp to xml
- xl to xml
- xlt to xml
- xltm to xml
- xmls to xml
- xmlx to xml
- xpr to xml