.xml

What is a .xml file?

Extensible Markup Language · Code and data · W3C · 1998

XML is a text format for structured data that uses nested tags, much like HTML. It is verbose but self-describing and strict, which made it the backbone of countless config files, feeds and document formats such as DOCX.

Category
Code and data
Type
Plain text
Is a .xml file safe to open? Generally safe, but XML parsers can be tricked by malicious entity definitions. Modern libraries disable those by default.

What is a .xml file used for?

XML wraps data in named tags that can nest, letting you describe complex structure in a way both people and programs can parse reliably.

It is more verbose than JSON, which has replaced it for many web APIs, but XML remains everywhere: RSS feeds, sitemaps, Office documents and enterprise systems all use it.

Because it is plain text with a clear structure, any editor opens it and validators can check it against a schema.

What opens a .xml file?

The .xml format opens in the following apps, grouped by operating system. If one app does not work, try another from the same list.

Windows

  • Notepad++
  • VS Code
  • any browser

macOS

  • VS Code
  • any browser

Linux

  • VS Code
  • any browser

Web

  • Browsers display XML as a tree

Open a .xml file step by step

  1. Confirm the file really is a .xml. Drop it into the WhatFileType identifier, which reads its signature in your browser without uploading anything.
  2. On Windows, open it with Notepad++ or VS Code.
  3. On Mac, use VS Code or any browser.
  4. On Linux, try VS Code or any browser.
  5. Still stuck? Convert the .xml to JSON, which opens more widely.

Why can't I open my .xml file?

Almost always because no installed app understands XML. Install one of the apps above, or convert the file to a format your existing software already reads. If double-clicking opens the wrong program instead of nothing at all, the file association is set to the wrong app rather than the file being broken.

The other possibility is that the file is not really a .xml at all. Drop it into the file identifier to check it by its bytes instead of its name. Nothing is uploaded.

How to convert a .xml file

You can convert a .xml file to JSON, CSV, YAML using a conversion tool or the export menu of an app that opens it.

What is the .xml file signature (magic bytes)?

A .xml file starts with the hex bytes 3C 3F 78 6D 6C, which read as <?xml in ASCII. Programs identify XML by those bytes, not by the filename, so a renamed file still gives itself away.

These are the documented signatures for XML. For a full breakdown, see the XML file signature page.

Documented magic-byte signatures for the .xml format
Hex signatureOffsetASCIINote
3C 3F 78 6D 6C0<?xml'<?xml'

See the full magic-numbers reference for every format.

Frequently asked questions

What is a .xml file?

XML is a text format for structured data that uses nested tags, much like HTML. It is verbose but self-describing and strict, which made it the backbone of countless config files, feeds and document formats such as DOCX.

Is XML the same as HTML?

They look similar and share ancestry, but HTML describes web pages with a fixed set of tags, while XML lets you define your own tags for any kind of data.

Comparisons

Related formats

Sources

Details on this page were checked against authoritative references. How sources are ranked and what is deliberately left out is set out in the methodology.