XML viewer, reader, and editor for Mac

View, read, and format XML on your Mac

To view an XML file on a Mac, open it in an XML viewer that shows its structure, not just its text. XML Lens is a native macOS XML viewer, reader, and editor: drag in a file and read it as a synchronized structure tree beside syntax-highlighted source, then search, format, minify, or edit it without uploading the document.

Listed as XML Editor Lens: XPath on the Mac App Store.

XML Lens XML viewer on macOS showing a structure tree, syntax-highlighted XML, and node inspector
Read XML as a structure tree beside highlighted source. Select any node to see its attributes, value, and XPath.

A clearer way to read XML

Open an XML file, paste XML from the clipboard, type directly, or drag a document into XML Lens. The editor and expandable tree stay synchronized so you can move from a node, attribute, or namespace to the corresponding source.

If the file you were sent is an .xsd schema rather than XML data, read what an XSD file is and how to open one on a Mac or Windows.

  • Syntax-highlighted XML editor with breadcrumbs
  • Structure tree for parent-child navigation
  • Node inspector with attributes, values, and generated XPath
  • Search tags, attributes, and values with previous/next match controls

How to view an XML file on a Mac without installing anything

macOS can already show you the text of an XML file. In Finder, right-click the file, choose Open With, then TextEdit. That is enough for a short file, but TextEdit shows plain text with no highlighting, no tree, and no way to fold or search by element.

If the XML arrived on one long line, Terminal can indent it first. macOS includes xmllint, so xmllint --format data.xml > data.formatted.xml writes an indented copy you can open in any editor, and xmllint --noout data.xml reports the line of the first error if the file is not well-formed.

An XML viewer adds what a text editor cannot: a collapsible tree of the document, a way to jump from an element to its source, and search that understands tags, attributes, and values.

For four-space or tab indentation, formatting in place, and what xmllint changes besides whitespace, see how to format XML on a Mac.

Looking for XML Notepad on Mac?

Microsoft XML Notepad is a free XML editor for Windows; its installers are Windows-only, so it does not run natively on macOS. Mac users searching for an XML Notepad alternative usually want the same thing it offers: a tree view beside the text, with editing and search.

XML Lens covers that workflow natively on macOS: the structure tree and source editor stay in sync, the inspector shows the selected node’s attributes and value, and you can format, minify, or edit the document and save it back to disk.

For a broader view that includes free editors such as BBEdit and Visual Studio Code, see how six XML editors for Mac compare on the same criteria.

Format for review, minify for payloads

Pretty-print compressed XML when you need to review it, or minify it when a compact payload is more useful. Comment removal and Compact for API or Readable for review presets keep common cleanup tasks close to the document.

  • Formatting and minification happen locally
  • Text zoom supports Command-Plus, Command-Minus, and Command-Zero
  • Dark, Light, Ocean, Forest, and Sepia themes are available

What XML Lens is—and is not

XML Lens supports macOS 14.0 or later and is currently version 1.9.13. It is a focused desktop viewer/editor, not an online XML validator or a browser-based collaborative editor; document processing stays on the Mac.

Frequently asked questions

What is the best way to view an XML file on a Mac?

For a quick look, open it in TextEdit. To read its structure, use an XML viewer that shows a collapsible tree beside the source, such as XML Lens, which also lets you search, format, and query the document locally.

Is there a free XML viewer for Mac?

TextEdit and the built-in xmllint command are free and already on your Mac. XML Lens is a free download with a 10-day full trial and an optional one-time Pro purchase.

Can I edit XML on a Mac, not just view it?

Yes. XML Lens is an XML editor as well as a viewer: edit the syntax-highlighted source while the structure tree updates, then format or minify the document and save it.

Is there an XML Notepad for Mac?

Microsoft XML Notepad is Windows-only. On a Mac, an XML viewer and editor with a tree view, such as XML Lens, covers the same reading and editing workflow natively.

Does XML Lens upload my XML files?

No. Opening, formatting, searching, and editing all happen on your Mac. XML Lens does not upload XML content, filenames, or paths, and it does not collect product analytics.