What Is a .XML File?
A .xml file is a plain text data file in Extensible Markup Language, which stores information in nested, self-describing tags such as <invoice> and <total>. It is used for data exchange, configuration, sitemaps, RSS feeds and document formats. Any text editor or browser can open an XML file.
- Extension
- .xml
- Full name
- Extensible Markup Language
- Type
- Code and web file
- MIME type
- application/xml, text/xml
- Developed by
- World Wide Web Consortium (W3C)
About XML files
XML looks like HTML, but its tags are invented by whoever designs the data format rather than defined by a standard set. A schema (XSD or DTD) can specify which tags are allowed, letting software validate files. Strict rules apply: every tag must close, attributes must be quoted, and there is a single root element, so a small typo makes the file unreadable to parsers.
Many familiar formats are XML underneath: SVG images, RSS and Atom feeds, website sitemaps, Android layouts, and the files inside .docx, .xlsx and .pptx packages. Banks, governments and enterprise systems still use XML heavily for invoices, tax filings and data interchange, even where newer web APIs have switched to JSON.
XML files can be large and verbose, but compress very well. When opening XML from untrusted sources, note that badly configured parsers can be attacked through external entity references (XXE); everyday viewing in a browser or editor is safe. XML files cannot run code on their own.
What XML files are used for
- Data exchange between business and government systems (e-invoices, tax filings)
- Website sitemaps and RSS feeds
- Configuration files for applications and build tools
- The internal structure of Office documents and SVG images
How to open a .xml file
Windows
Open it in Notepad, or in Edge to see the tag tree. VS Code adds colour-coding and formatting.
Mac
Open it in TextEdit, VS Code or Safari. Quick Look in Finder shows the raw text.
Online / any browser
Chrome, Firefox and Edge display XML files as a collapsible tree when no stylesheet is attached.
Spreadsheets
Excel can import XML data through Data > Get Data > From File > From XML.
How to convert a .xml file
To get a table, open the XML in Excel using Data > Get Data > From File > From XML and save as .xlsx or .csv.
To transform XML into HTML or another XML structure, use an XSLT stylesheet; developers also commonly convert to JSON with a script.
Renaming .xml to .xlsx or .docx does not work; those formats are ZIP packages that contain several XML files with specific structures.
Changing the extension in the file name does not convert the file. See how to change a file extension for when renaming is safe.
Naming and renaming XML files
- Keep names that software expects exactly: sitemap.xml, AndroidManifest.xml and pom.xml must not be renamed.
- For exports such as invoices, put the document number and date in the name (invoice-2025-0142.xml) since recipients cannot preview XML easily.
- Use lowercase and hyphens for web-served XML (product-feed.xml) because URLs on many servers are case-sensitive.
Renaming lots of .xml files? See how to rename xml files with ai, use the free online bulk renamer for patterns and numbering, or try File Renamer AI to name each file from what is inside it.
Related file types
A .json file is a plain text data file in JavaScript Object Notation, a lightweight format of names, values, lists and nested objects. It is the standard way web APIs exchange data and a common format for app settings, exports and configuration. Any text editor opens JSON, and browsers can display it nicely.
A .html or .htm file is a web page written in HyperText Markup Language. It is plain text with tags that describe headings, paragraphs, links, images and forms, which a web browser renders as a formatted page. Double-clicking an HTML file opens it in your default browser; any text editor can edit it.
A .svg file is a Scalable Vector Graphics image: a text file written in XML that describes shapes, paths and text rather than pixels. SVGs stay perfectly sharp at any size, are usually tiny, and display in every web browser, which makes them the standard format for logos, icons and web illustrations.
A .csv file is a plain-text table where each line is a row and commas separate the columns. It has no formatting, formulas or multiple sheets, which makes it the universal format for moving data between spreadsheets, databases, banking portals, CRMs and code. Any text editor or spreadsheet app can open it.
Frequently Asked Questions
How do I open an XML file in a readable format?
Open it in a browser to see a collapsible tree, in VS Code for formatting, or import it into Excel to see the data as a table.
What is the difference between XML and HTML?
HTML has a fixed set of tags for displaying web pages; XML lets each format define its own tags for describing data.
XML or JSON: which should I use?
JSON is simpler and dominant for web APIs; XML is better when you need schemas, mixed text and markup, or must meet an existing standard.