What Is an XML File? How to Open, Edit and Use It
If you have ever downloaded a file ending in .xml, opened a website sitemap, or looked inside a settings file, you have probably met XML without realizing it. XML stands for Extensible Markup Language, and it is one of the most common ways computers store and share structured data. Despite the technical-sounding name, the basic idea is simple, and you do not need to be a programmer to understand it.
An XML file is, at its heart, a plain text file that stores data inside labelled tags. Those tags describe what each piece of information is, rather than how it should look on screen. That is why XML is readable by both people and programs: you can open it and make sense of it, and software can read the same file and use the data in a reliable, predictable way. In this guide, you will learn what an XML file looks like, what XML files are used for, and how to open, edit, and convert one on Windows, Mac, in Excel, or online.

What Does an XML File Look Like?
An XML file looks a lot like ordinary text with extra labels wrapped around the information. Here is a short, simple example of a contact note stored as XML:
<?xml version="1.0" encoding="UTF-8"?>
<contact>
<name>Alex Morgan</name>
<email>alex@example.com</email>
<phone>555-0142</phone>
<city>London</city>
</contact>Let us walk through the parts of that example in plain words. The first line is the declaration. It tells a program that this is an XML document, which version of XML it uses, and which character encoding it uses. You will see a similar first line at the top of many XML files, and you usually do not need to change it.
Next comes the root element. In this example, the root element is contact. Every XML document has exactly one root element, and it acts as the container for everything else, like the cover of a folder holding all the pages inside. Inside the root element are smaller elements, each made of an opening tag, a value, and a closing tag. For example, <name>Alex Morgan</name> means the name field holds the value Alex Morgan. The opening tag and closing tag must match, and the closing tag has a forward slash at the start.
The tag names are the key to understanding XML. Unlike some other formats, XML does not force you to use a fixed list of tags. Instead, the person or program creating the file chooses tag names that describe the data, such as name, email, phone, and city. That flexibility is why XML is called extensible: it can be extended to describe almost any kind of structured information, from a single contact to a product catalog, a website sitemap, or a full set of app settings. When you read an XML file, start with the tag names, and the structure usually becomes clear very quickly.
What Are XML Files Used For?
XML is used in far more places than most people realize, because it is a safe, simple way to move structured data between different systems. If two programs were built by different companies, at different times, they still need a shared way to describe the same information. XML gives them that shared language, without forcing them to use the same software.
Websites and sitemaps. Search engines use XML sitemaps to discover the pages on a website. A sitemap is an XML file that lists a site’s pages, when they were last updated, and how important they are relative to each other. If you run a website, your sitemap is usually found at an address ending in sitemap.xml, and it helps search engines crawl your site more completely. Many websites also use XML behind the scenes to store menus, page data, and other content.
RSS feeds. RSS, which is built on XML, is how blogs, news sites, and podcasts publish updates that other apps can follow. When you subscribe to a feed in a news reader or podcast app, that app regularly checks an XML file for new items. Each item in the file contains a title, a link, a date, and a short description, all neatly labelled so the reader can display them in a clean list.
Microsoft Office documents. Modern Word, Excel, and PowerPoint files are built on XML, even though they do not look like it. A .docx file is really a compressed package of XML files that describe the text, styles, images, and layout of a document. The same is true for .xlsx spreadsheets and .pptx presentations. That is one reason Office files can be opened, repaired, and converted by many different programs: the data inside is stored in a standard, readable format.
App and game settings. Many desktop programs, mobile apps, and games store their settings and configuration in XML files. A settings file might record your preferred language, screen size, sound volume, or the location of your saved games. Because the file is plain text, a program can read it quickly when it starts, and a user or support team can open it to check a setting without special software. If an app ever asks you to send a configuration file, there is a good chance it is an XML file.
Sharing data between programs and companies. Perhaps the most important use of XML is data exchange. A shop might send its product list to a supplier in XML, a bank might exchange transaction records in XML, and a weather service might publish forecasts in XML for other apps to use. Because XML is platform independent, it works on Windows, Mac, Linux, phones, and servers alike, and it does not depend on any one company’s software. That neutrality is a large part of why XML has lasted for decades, even as newer formats have appeared.
How to Open an XML File
The good news is that you almost certainly already have a program that can open an XML file. You do not need to buy anything special. The best choice depends on whether you want a quick look, the raw code, or a table you can work with. Start with the simplest option, and move on only if you need more.
Open it in any web browser
For a quick, readable view, drag the XML file into a web browser such as Chrome, Edge, Firefox, or Safari, or right-click the file, choose Open With, and pick your browser. Most browsers show the XML in a structured, collapsible tree, so you can expand and collapse sections to explore the data. This is a great first step when you just want to see what is inside a file, and it is safe because the browser only displays the text. Keep in mind that a browser view is for reading, not editing: changes you make there will not save back to the file.
Open it in a text editor for the raw view
If you want to see the file exactly as it is written, open it in a text editor. On Windows, right-click the file and choose Open With, then Notepad. On a Mac, use TextEdit in plain-text mode. For a clearer view with color coding and line numbers, a free code editor such as Visual Studio Code is an excellent choice. A text editor shows every tag and value, which makes it the right tool for checking a file closely or making a small edit. Just be careful to save a backup copy before you change anything, so you can restore the original if a change breaks the structure.
Open it in Microsoft Excel as a table
If the XML file contains rows of similar records, such as products, contacts, or orders, Excel can turn it into a table. In Excel, go to Data, then Get Data, then From File, then From XML, and select your file. Excel will show a preview of the data, let you choose which elements to include, and load them into rows and columns you can sort, filter, and save as a spreadsheet. This route is ideal when you want to work with the data rather than read the code. If Excel asks how to handle the file, the default import settings are usually fine for a first look.
Use an online XML viewer
An online XML viewer is a useful option when you are on a computer without suitable software, or when you want the file formatted neatly with one click. You paste the XML text or upload the file, and the viewer displays it as a tree, formats it with indentation, and sometimes checks it for errors. This is convenient, but use it with care: do not upload files that contain passwords, personal details, or confidential business data to a website you do not trust. For private files, a local browser or text editor is the safer choice.
XML vs HTML: What Is the Difference?
XML and HTML look similar because both use tags, but they have different jobs. HTML is designed to display a web page in a browser. XML is designed to carry and describe data. That single difference explains most of the other differences between them.
| Feature | XML | HTML |
|---|---|---|
| Purpose | Stores and carries data | Displays web pages |
| Tags | You create your own tags to describe data | Uses a fixed set of tags, such as headings and links |
| Strictness | Very strict: every tag must close and nest correctly | More forgiving: browsers often fix small mistakes |
| What happens with errors | A broken file may fail to load or show an error | The page usually still shows, even if it looks slightly wrong |
In short, HTML tells a browser what a page should look like, while XML tells a program what a piece of data means. The two often work together: a website might store its content as XML and then use HTML to present it to visitors.
Can You Edit or Create an XML File?
Yes. You can edit or create an XML file in any text editor, including Notepad, TextEdit, or Visual Studio Code. Open the file, make your change, and save it with the .xml ending. If you are creating a file from scratch, start with one root element, add your elements inside it, and save the result as a plain text file with .xml at the end of the name.
Follow three golden rules and most problems will be avoided. First, close every tag: every opening tag needs a matching closing tag. Second, nest tags properly: if you open a tag inside another tag, close the inner tag before you close the outer one, like closing boxes inside boxes in the right order. Third, save with .xml and keep the file as plain text, not as a Word document, so programs can read it correctly. It also helps to keep a backup copy before editing a settings file, so you can restore it if something goes wrong.
To convert XML to CSV or Excel, the simplest route is Excel: import the XML file as described above, then save the result as an .xlsx or .csv file. For a one-off conversion, a reputable online XML to CSV converter can also do the job, but avoid uploading private or sensitive data to an online tool.
Frequently Asked Questions
Is XML a programming language?
No. XML is not a programming language. It is a markup and data format: a set of rules for labelling and storing information in text. It does not run code or make decisions on its own. Programs read XML files and act on the data inside them, but XML itself simply describes the data.
Is it safe to open an XML file?
Yes, opening an XML file as text is generally safe, because the file itself is just text. As with any file, though, be careful with files from unknown senders: do not run any program or script that a file tells you to download, and do not upload a file containing personal information to an untrusted website. When in doubt, open the file in a browser or text editor first and read it before you do anything else with it.
What program opens XML files?
A web browser, a text editor, or Excel can all open XML files. Use a browser for a quick structured view, a text editor such as Notepad, TextEdit, or Visual Studio Code for the raw code, and Excel when you want the data as a table. An online XML viewer is another option for a neatly formatted view.
What is the difference between XML and HTML?
HTML shows web pages, while XML carries data. HTML uses a fixed set of tags to control how a page looks, and browsers are forgiving of small errors. XML lets you define your own tags to describe data, and it is strict about closing and nesting tags correctly, so a broken XML file may fail to load.
Can I convert XML to Excel or CSV?
Yes. In Excel, use Data, Get Data, From File, and From XML to import the file as a table, then save it as an .xlsx or .csv file. You can also use a reputable online converter for a one-off conversion, but avoid uploading files that contain private or sensitive data.
An XML file may look technical at first glance, but it is simply labelled text. Once you recognize the root element, the tags, and the values inside them, you can open, read, edit, and convert XML files with tools you already have.
[…] What Is an XML File? How to Open, Edit and Use It […]
[…] most people, viewing the source is enough. Like an XML file, an ASP file is plain text at heart, so a text editor shows you exactly what is inside: the page […]
[…] groups will help you choose the right program and format when you save your own work. For example, an XML file is a structured text format, while a CSV file is a plain-text way to store […]