How to format XML in Notepad++?

Try Plugins -> XML Tools -> Pretty Print (libXML) or (XML only – with line breaks Ctrl + Alt + Shift + B)

You may need to install XML Tools using your plugin manager in order to get this option in your menu.

In my experience, libXML gives nice output but only if the file is 100% correctly formed.

How to format XML in Notepad++?

You need to install the XML tool from the Plugins menu item → Plugins Admin… → Plugins Admin dialog appears and then scroll to bottom of available plugins and check the XML tools, install it and then Ctrl + Alt + Shift + B OR the option for XML Tool above shows up.

Answer #2:

Step 1: Install XML Tools plugin

Step 2: Format ….completed

Answer #3:

Try TextFX → TextFX Html Tidy → Tidy: reindent XML

If you can’t try with Eclipse, do right button, source, and correct indent.

Answer #4:

Plugins -> XML Tools -> Pretty Print (libXML) or Ctrl+Alt+Shift+B

You probably need to install the plugin:

Plugins > Plugins Manager > Show Plugins Manager

Then copy XMLTools.dll to the plugins directory and external libraries (four dlls) into the root Notepad++ directory.

Answer #5:

Here are most of plugins you can use in Notepad++ to format your XML code.

  • UniversalIndentGUI
    (I recommend this one)

Enable ‘text auto update’ in plugin manager-> UniversalIndentGUI
Shortkey = CTRL+ALT+SHIFT+J

  • TextFX
    (this is the tool that most of the users use)

Shortkey = CTRL+ALT+SHIFT+B

  • XML Tools
    (customized plugin for XML)

Shortkey = CTRL+ALT+SHIFT+B

Answer #6:

All the previous answers do not define how to add the plugin manager in your Notepad++ installation.

This is for the folks who do not see the the plugin manager in the plugin tab

Download the plugin manager from this link – this is for the 64-bit plugin manager. Once you download the plugin manager, paste into the plugin folder. This is was my location of plugin folder: C:\Program Files\Notepad++\plugins

After pasting the .dll file restart Notepad++. Now you can install any plugin. To install a plugin, click on the plugin tab, then go to plugin manager and select plugin whatever you want.

Answer #7:

For best results, you should use both TextFX XML tidy and XML tools pretty print. Here’s how and why:

1.TextFX -> TextFX HTML Tidy -> Tidy: reindent XML

TextFX has the benefit of wrapping long lines, which XML Tools does not do, but it doesn’t indent those new lines correctly.

2. XML Tools -> Pretty print (Text indent)

XML Tools complements TextFX by indenting the newly wrapped lines nicely.

Answer #8:

OK, here is how I did it in Notepad++:

  • Plugins
  • Plugin manager
  • Show plugin manager
  • Check XML tools
  • Install
  • Restart Notepad++
  • Open XML file
  • Plugins
  • XML tools
  • Pretty print (XML only — with line breaks)

Answer #9:

Installing the XML Tools

If you run Notepad++ and look in the Plugins menu, you’ll see that the XML Tools aren’t there:

  1. Download the XML tools from here.
  2. Unzip the file and copy the XMLTools.dll to the Notepad++ plugins folder (in the example above: C:\Program Files (x86)\Notepad++\plugins):
  3. Re-start Notepad++ and you should now see the XMLTools appear in the Plugins menu.
  4. Unzip the ext_libs.zip file and then copy the unzipped DLLs to the Notepad++ installation directory (in the example above: C:\Program Files (x86)\Notepad++).
  5. Re-start Notepad++ and you should finally see the proper XML Tools menu.
  6. The feature I use the most is “Pretty print (XML only – with line breaks)”. This will format any piece of XML with all the proper line spacing.

Answer #10:

The location of XML tools has changed slightly since this question was first asked.

I am currently using Notepad++ v7.8.6

New location is:

  • Plugins tab
  • Plugins Admin…
  • Plugins Admin dialog appears with Available plugins tab as the default
  • Scroll to the bottom and check the XML Tools checkbox
  • Click Install button in top right of the dialog

This will close Notepad++ while it installs and then restart it automatically.

Then there are a couple keyboard shortcuts to beautify the XML:

  • Pretty Print: Ctrl + Shift + Alt + B
  • Pretty Print (indent attributes): Ctrl + Shift + Alt + A

To see more XML Tools options:

  • Plugins tab
  • XML Tools option

Hope you learned something from this post.

Follow Programming Articles for more!

About ᴾᴿᴼᵍʳᵃᵐᵐᵉʳ

Linux and Python enthusiast, in love with open source since 2014, Writer at programming-articles.com, India.

View all posts by ᴾᴿᴼᵍʳᵃᵐᵐᵉʳ →