How to Open an XML File (Windows, Mac and Online)

The easiest way to open an XML file is to right-click it, choose Open with, and pick a web browser such as Chrome or Edge. The browser shows the file as a readable tree. To edit it, use Notepad or another text editor. To work with the data as a table, open it in Excel.

Which program should you use to open an XML file?

You want to…Use thisWorks on
Read the fileA web browser (Chrome, Edge, Firefox)Windows, Mac, Linux
Edit the fileNotepad, Notepad++, VS Code or TextEditWindows (Notepad, Notepad++), Mac (TextEdit), both (VS Code)
See the data as rows and columnsExcel, or an XML to Excel converterAny device (converter), Excel on Windows and Mac
Check whether the file is validA web browser. It shows an error with the line number if something is wrong.Any device

Method 1: Open an XML file in a web browser

  1. Right-click the XML file and choose Open with, then pick Chrome, Edge or Firefox. You can also drag the file into an open browser window.
  2. The browser shows the file’s contents. In Chrome and Edge you will see a note saying the file has no style information, followed by the document tree. That message is normal.
  3. In Chrome and Edge you can collapse and expand the tags to scan a long file quickly.

This is the best way to read a file safely, because the browser does not change it. It is also a quick validity test: if the XML is broken, the browser shows an error that names the line and column.

Method 2: Open an XML file in a text editor

XML is plain text, so any text editor can open it and edit it.

  • Windows: right-click the file, choose Open with > Notepad. For large files or colour-coded tags, install the free Notepad++ or Visual Studio Code.
  • Mac: right-click, choose Open With > TextEdit. If TextEdit shows formatted text instead of code, go to Format > Make Plain Text.

Method 3: Open an XML file in Excel

If the XML holds a list of records, such as orders or products, Excel can show it as a table. Go to File > Open, pick the file and choose As an XML table, or use Data > Get Data > From File > From XML for nested data. Our full guide walks through each version: how to open an XML file in Excel.

Method 4: Convert the XML to Excel or CSV

When the file is large, deeply nested or you do not have Excel set up for XML, convert it. The free XML to Excel converter runs in your browser, so your file is not uploaded. It turns the records into rows and lets you download .xlsx, .xls or CSV. If you only need a CSV file, use our free XML to CSV converter.

To go the other direction and turn a spreadsheet into XML, use the free Excel to XML converter.

Method 5: Open an XML file online or on a phone

If the XML file is hosted at a web address, paste the address into any browser, including a phone browser. For a file saved on your phone, open it from your file manager with an app that can show text files.

Be careful with online XML viewers. Many ask you to upload the file to their server, so avoid them for anything private such as invoices, payroll or customer data. Tools that run in your browser keep the file on your device.

How to choose the default program for XML files on Windows

  1. Right-click the XML file and choose Open with > Choose another app.
  2. Pick the program you want, for example Notepad or Chrome.
  3. Tick Always use this app to open .xml files and click OK.

How to edit an XML file safely

  1. Make a copy first. Keep the original in case something breaks.
  2. Open the copy in a text editor such as Notepad, Notepad++ or VS Code.
  3. Change the text between tags without touching the tags themselves. Every opening tag such as <name> needs a matching </name>.
  4. Escape special characters. Write &amp; for &, &lt; for < and &gt; for >.
  5. Save as plain text in UTF-8 so accented characters survive.
  6. Check the result by opening it in a browser. If it shows a tree, the file is valid.

What an XML file looks like

XML stores data in nested tags. This small example holds one customer:

<customer id="1001">
  <name>Ayesha Khan</name>
  <email>ayesha@example.com</email>
</customer>

Each pair of tags wraps a value, and tags can contain other tags. That nesting is why a plain table is not always the best view of XML.

XML file will not open? Try these fixes

  • Windows asks which app to use. Choose a browser or Notepad, as described above.
  • The file opens as a wall of text. Open it in a browser or Notepad++ to see the structure.
  • The file freezes your editor. Very large files can overwhelm Notepad. Use Notepad++ or VS Code, or convert it to Excel or CSV.
  • The browser shows an error. The XML is not valid. Read the line and column in the message, then fix the tag or character it points to. A bare & is a common cause.
  • The file comes from a specific program (tax, accounting or payroll software). Open it in that program, because it may expect a particular structure.
  • The file is empty or tiny. The download may have failed. Download it again.

Frequently asked questions

What program opens an XML file?

Any web browser or text editor can open one. Excel can open it as a table.

Can I open an XML file in Notepad?

Yes. Right-click the file and choose Open with > Notepad. Notepad shows the raw tags and lets you edit them.

How do I open an XML file on a Mac?

Use a browser or TextEdit (Open With > TextEdit, then Format > Make Plain Text if needed). For a table view, use an XML to Excel converter in your browser.

How do I open an XML file in Excel?

Use File > Open and choose “As an XML table”, or Data > Get Data > From File > From XML. See our step-by-step guide.

Is an XML file safe to open?

Opening it in a browser or text editor only shows text. Be cautious about files from unknown senders, and do not run or import them into software you do not trust.

How can I tell if my XML file is valid?

Open it in a browser. If the browser shows the document tree, the file is well-formed. If it shows an error, the message names the line and column to fix.

Want to work faster in Excel with AI? Grab the free ChatGPT Prompts for Excel pack.

Similar Posts