11 min read read
By Imad Uddin

6 Best XML Extensions for VS Code in 2026 (Tested & Ranked)

6 Best XML Extensions for VS Code in 2026 (Tested & Ranked)

VS Code can open XML files but can't do much with them. You get colored text but no formatting, no error checking, no helpful shortcuts.

One extension fixes most of this: XML by Red Hat. It's free and adds everything VS Code is missing for XML work.

After installing it, you can:

  • Format messy XML with one keyboard shortcut
  • See errors highlighted as you type
  • Get suggestions for what to type next
  • Search through XML with XPath queries

This guide covers that extension plus five others for specific needs.

The 6 Best XML Extensions for VS Code in 2026 in 2026

1. XML by Red Hat (Start Here)

Red Hat XML Extension in VS Code
Red Hat XML Extension in VS Code

This is the one extension most people need. It makes VS Code understand XML properly.

How to install:

  1. Open VS Code
  2. Click the Extensions icon on the left sidebar (or press Ctrl + Shift + X)
  3. Type "XML" in the search box
  4. Find "XML" by Red Hat
  5. Click the Install button

That's it. No configuration needed. It starts working immediately.

What this extension does:

  • Formats messy XML: Press Shift + Alt + F and single-line XML becomes readable
  • Shows errors as you type: Red squiggly lines appear under mistakes
  • Suggests what to type: Start typing and it shows valid options
  • Explains elements: Hover your mouse over any tag to see what it does
  • Finds things fast: Collapse sections you don't need to see right now

Does it work with large files?

Yes, up to about 10-15MB. Bigger files slow down. If you're working with huge XML files (50MB+), the extension might lag. Most people never hit this limit.

Who uses this:

  • Anyone editing Spring configuration files
  • Android developers working with manifest files
  • Maven users editing pom.xml files
  • People working with SVG graphics
  • API developers handling XML requests

Bottom line: If you edit XML in VS Code, install this extension. It's free and makes everything easier.

Download: XML by Red Hat on VS Code Marketplace

2. XML Tools (Optional - For Faster Formatting)

XML Tools Extension
XML Tools Extension

This extension does less than Red Hat's but runs faster. Install it if you format XML files constantly and want speed.

How to install:

Same as before: Extensions icon → search "XML Tools" → Install.

What this extension does:

  • Formats XML faster: Different keyboard shortcut, same result
  • Shows your location: The bottom bar shows where you are in the XML structure
  • Removes all spacing: Makes XML compact for storage
  • Searches with XPath: Finds specific parts of your XML

Do you need both Red Hat and XML Tools?

You can install both. They don't conflict. Use Red Hat for error checking. Use XML Tools when you need faster formatting.

What it doesn't do:

XML Tools doesn't check for errors. It just formats and searches. That's why you might want both extensions.

Download: XML Tools on VS Code Marketplace

XML Extension Comparison Table

ExtensionXSD ValidationXPath VersionXSLT SupportBest for
XML by Red HatYes2.0, 3.1NoSchema validation and autocomplete
XML ToolsNo1.0NoFast formatting and simple XPath
XSLT/XPathNo3.1Yes (3.0)XSLT development and debugging
Auto Close TagN/AN/AN/AAutomatic tag closing
PrettierNoN/ANoConsistent formatting across team
XML FormatNoN/ANoOne-click formatting

3. XSLT/XPath (Only If You Use XSLT)

XSLT XPath Extension
XSLT XPath Extension

Do you need this? Only if you work with XSLT files. Most people don't. XSLT transforms XML from one format to another.

If you don't know what XSLT is, skip this extension. You don't need it.

How to install:

Extensions icon → search "XSLT/XPath" → Install.

What this extension does:

  • Makes XSLT files readable with proper colors
  • Lets you run XSLT transformations inside VS Code
  • Shows suggestions while writing XSLT code

Who needs this:

  • Technical writers using specialized documentation systems
  • Developers transforming XML data between formats
  • Anyone maintaining older websites that use XSLT

Download: XSLT/XPath on VS Code Marketplace

4. Auto Close Tag (Nice to Have)

Auto Close Tag Extension
Auto Close Tag Extension

This extension saves typing. When you type an opening tag like

<book>
, it automatically adds the closing tag
</book>
.

How to install:

Extensions icon → search "Auto Close Tag" → Install.

What this extension does:

Type

<book>
and press Enter. The extension automatically adds
</book>
for you. Your cursor stays in the middle so you can type the content.

This works for HTML too, not just XML.

Do you need this?

It's convenient but not essential. If you type a lot of XML, it saves time. If you only edit XML occasionally, you can skip it.

Download: Auto Close Tag on VS Code Marketplace

5. Prettier (For Teams)

Prettier Extension
Prettier Extension

Prettier makes sure everyone on your team formats XML the same way. If you work alone, you don't need this.

How to install:

Extensions icon → search "Prettier" → Install.

What this extension does:

When anyone on your team saves an XML file, Prettier formats it the same way. No more arguments about spacing or indentation.

Do you need this?

Only if you work on a team and want consistent formatting. For solo work, Red Hat's extension already formats XML fine.

Download: Prettier on VS Code Marketplace

6. XML Format

XML Format Extension
XML Format Extension

Lightweight formatting extension. One command, formats XML, done.

Install:

Search "XML Format" by mikeburgh, install.

code --install-extension mikeburgh.xml-format

What you get:

  • Format XML with Ctrl/Cmd + Shift + P > "Format XML"
  • Configurable indentation (spaces or tabs)
  • Handles malformed XML (attempts to format even with errors)

What you don't get:

  • Schema validation
  • XPath queries
  • Autocomplete

This extension does one thing: format XML. If you already have Red Hat's extension, you don't need this. But if you want minimal overhead and just need formatting, XML Format is lighter.

Download: XML Format on VS Code Marketplace Free

Common XML Editing Workflows in VS Code

Editing Spring Framework configuration files:

  1. Install XML by Red Hat
  2. Add schema reference to your XML: xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"
  3. Get autocomplete for bean definitions, property names, and ref attributes
  4. Catch typos in bean IDs before deployment

Working with Maven pom.xml files:

  1. XML by Red Hat recognizes pom.xml automatically
  2. Autocomplete for dependency groupId, artifactId, version
  3. Validation against Maven XSD catches structural errors
  4. Format with Shift + Alt + F before committing

Editing Android manifest files:

  1. Open AndroidManifest.xml in VS Code
  2. XML by Red Hat provides autocomplete for permissions, activities, services
  3. Validation catches missing required attributes
  4. Hover documentation explains permission purposes

Transforming XML with XSLT:

  1. Install XSLT/XPath extension
  2. Create your XSLT stylesheet
  3. Run transform via Command Palette
  4. Output appears in new tab for review

Recommended Extension Combinations

For most developers:

  • XML by Red Hat (validation and autocomplete)
  • Auto Close Tag (automatic closing tags)

For XSLT developers:

  • XML by Red Hat (validation)
  • XSLT/XPath (XSLT syntax and transforms)
  • Auto Close Tag (automatic closing tags)

For teams:

  • XML by Red Hat (validation)
  • Prettier with XML plugin (consistent formatting)
  • Auto Close Tag (automatic closing tags)

For quick XML editing:

  • XML Tools (fast formatting and XPath 1.0)
  • Auto Close Tag (automatic closing tags)

For Spring Framework developers:

  • XML by Red Hat (bean definition validation)
  • Auto Close Tag (faster bean configuration)
  • Prettier (consistent formatting across team)

Which Extensions Should You Actually Install?

If you just want to format and edit XML files: Install XML by Red Hat. That's it. One extension, free, covers 90% of XML work.

If you also work with XSLT stylesheets: Add the XSLT/XPath extension. It understands XSLT syntax.

If you want faster formatting: Add XML Tools. It's lighter and formats faster than Red Hat's extension.

If you work on a team: Add Prettier for consistent formatting across everyone.

Most people only need XML by Red Hat. Add others only if you have specific needs.

Frequently Asked Questions

Step 1: Install core extensions

code --install-extension redhat.vscode-xml
code --install-extension formulahendry.auto-close-tag

Step 2: Configure settings

Add to settings.json (Ctrl/Cmd + , then click "Open Settings (JSON)"):

{
  "xml.validation.enabled": true,
  "xml.format.enabled": true,
  "xml.format.splitAttributes": false,
  "xml.format.joinContentLines": false,
  "editor.formatOnSave": true,
  "auto-close-tag.activationOnLanguage": ["xml"]
}

Step 3: Add schema validation

Create .vscode/settings.json in your project:

{
  "xml.fileAssociations": [
    {
      "pattern": "**/*.config.xml",
      "systemId": "schemas/config.xsd"
    }
  ]
}

Step 4: Test XPath queries

Open an XML file. Press Ctrl/Cmd + Shift + P, type "XML: Execute XPath", enter query like //book[@category='web']. Results highlight in your document.

Step 5: Add keyboard shortcuts (optional)

Open Keyboard Shortcuts (Ctrl/Cmd + K, Ctrl/Cmd + S). Search for "XML" to see all XML-related commands. Add custom shortcuts for commands you use frequently:

  • XML: Execute XPath
  • XML: Format Document
  • XSLT: Run XSLT Transformation (if using XSLT/XPath extension)

This speeds up repetitive tasks compared to using Command Palette every time.

Frequently Asked Questions

What's the best XML extension for VS Code?

XML by Red Hat. Install it with Ctrl/Cmd + Shift + X, search "XML" by Red Hat. You get XSD and DTD validation, XPath 2.0/3.1 queries, schema-aware autocomplete, and formatting. It handles Spring configs, Maven POMs, Android manifests, and SVG files. Free and actively maintained by Red Hat. For most XML work in VS Code, this is the only extension you need.

How do I validate XML against XSD in VS Code?

Install XML by Red Hat extension. Add schema reference to your XML file: xsi:noNamespaceSchemaLocation="schema.xsd" in the root element. Or configure file associations in settings.json with xml.fileAssociations. The extension validates as you type and shows errors with red squiggles. Hover over errors for details. This works for local XSD files and remote schema URLs.

Does VS Code support XSLT?

Yes, with the XSLT/XPath extension by DeltaXML. It provides XSLT 1.0/2.0/3.0 syntax highlighting and lets you run transforms directly in VS Code. Press Ctrl/Cmd + Shift + P, type "XSLT: Run XSLT Transformation", select your XML input file. Output appears in a new tab. Red Hat's XML extension doesn't handle XSLT, so install both if you're doing XSLT work.

How do I format XML in VS Code?

Install XML by Red Hat extension. Open your XML file and press Shift + Alt + F (Windows/Linux) or Shift + Option + F (Mac). The extension formats with proper indentation. Configure formatting in settings: xml.format.splitAttributes (true/false), xml.format.joinContentLines (true/false). For team consistency, use Prettier with the XML plugin instead.

Can I run XPath queries in VS Code?

Yes. Install XML by Red Hat for XPath 2.0/3.1 or XML Tools for XPath 1.0. With Red Hat: press Ctrl/Cmd + Shift + P, type "XML: Execute XPath", enter your query. Results highlight in your document. With XML Tools: same command palette, type "XML Tools: Evaluate XPath". Red Hat's XPath 3.1 has more features but XML Tools' XPath 1.0 is faster for simple queries.

How do I edit large XML files in VS Code?

VS Code handles XML files up to 10-15MB reasonably well with Red Hat's extension. Beyond that, validation slows down. Disable validation temporarily with "xml.validation.enabled": false in settings. For files over 50MB, use a specialized tool like oXygen XML Editor or command-line tools like xmllint. VS Code's Electron architecture struggles with very large files regardless of extensions.

What's the difference between XML by Red Hat and XML Tools?

Red Hat has XSD validation and XPath 3.1. XML Tools has faster formatting and XPath 1.0. Red Hat uses a language server (Eclipse LemMinX) for accurate validation. XML Tools is lighter with less overhead. Install both. Use Red Hat for validation and autocomplete. Use XML Tools for quick formatting and simple XPath queries. They don't conflict.

Do I need oXygen XML Editor if I have VS Code with XML extensions?

For most XML work, no. VS Code with Red Hat's extension handles validation, formatting, and XPath queries. You only need oXygen ($99-$499/year) if you're doing XSLT debugging with breakpoints, creating XSD schemas visually, or working with specialized XML formats like DITA or DocBook that need advanced authoring features. For Spring configs, Maven POMs, Android manifests, and SVG files, VS Code extensions are sufficient.

Can VS Code replace Notepad for XML editing?

Yes, with better features. VS Code with XML by Red Hat provides schema validation that Notepad lacks. Both format XML, but VS Code adds autocomplete, hover documentation, and XPath evaluation. The tradeoff: VS Code uses more memory (200-300MB vs 20-40MB for Notepad). If you're already using VS Code for development, use it for XML too. If you only edit XML occasionally and want minimal resource usage, Notepad with XML plugins is lighter.

Related Reading

These guides help when VS Code is not the only editor in your workflow, or when teammates use different tools across Windows, macOS, and Linux:

  1. Best XML editors for Mac
  2. Best XML editors for Windows
  3. Best XML editors for Linux
  4. Best JSON extensions for VS Code
  5. Best JSON plugins for Sublime Text

If you're comparing data formats, JSON vs XML vs YAML breaks down where each one fits best.

Need to combine multiple XML files? The XML merger tool handles it in your browser without installing anything.

Read More

All Articles