Categories
code-formatting notepad++

How do I format XML in Notepad++?

1970

I have Notepad++ and I got some XML code which is very long. When I pasted it in Notepad++ there was a long line of code (difficult to read and work with).

I want to know if there is a simple way to make the text readable (by readable I mean properly tabbed code).

I can do it manually, but I want a permanent solution to this as I have faced this several times. I am sure there is a way to do this as I have done it once before a couple of years back, maybe with Visual Studio or some other editor, I don’t remember.

But can Notepad++ do it?

3

  • 3

    Configuring the XMLTools is bit tricky with latest versions. In Windows 10, Notepad++ version V6.6.8 I have configured XMLTools 2.4.7 successfully. Download the latest plugin from this link and follow the instruction in install.txt > notepad-plus-plus.org/community/topic/125/… .

    Mar 28, 2017 at 8:20

  • 1

    Current solution for the 64bit version: superuser.com/q/1239935/333622

    – Raidri

    Mar 9, 2018 at 10:45

  • 2

    @S.Roshanth seems to be resolved in latest 8.x versions of 64-bit Notepad++. Just use Plugins -> Plugins Admin and search for XMLTools and install there. The menu options to format then appear in Plugins -> XML Tools.

    – Shiv

    Sep 16, 2021 at 6:58

2773

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.

25

  • 666

    if you cant find XML Tools under Plugins, intall it from Plugins > Plugins Manager > Show Plugins Manager

    – ala

    Apr 3, 2012 at 1:56

  • 33

    If you get the “Errors detected in content” error when trying to use this plugin, try XML Tools -> Check XML syntax now. I had an issue where the encoding was specified as UTF-16 but was actually UTF-8. Changing the encoding attribute in the XML file fixed the problem.

    Jul 20, 2012 at 18:33

  • 158

    And if your Plugins Manager can’t find XML Tools because you are behind a proxy at work, download it from here sourceforge.net/projects/npp-plugins/files/XML%20Tools Then copy XMLTools.dll to the plugins directory and the rest of the four dlls to the root Notepad++ directory.

    Dec 4, 2012 at 19:06


  • 15

    Ad if you cannot see any plugin available, go to “updates” and update your plugin manager.

    Feb 14, 2013 at 13:50

  • 37

    …AND if you don’t have a Plugin Manager plugin, you can get it from here: github.com/bruderstein/nppPluginManager/releases

    – Chris W

    Jan 18, 2017 at 21:50


151

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.

    118

    Step 1: Install XML Tools plugin
    Step 2: Format ....completed
    

    enter image description here

    2

    • 2

      great answer, however i don’t have the “Plugin Manager” o_O Can someone help? Was it removed meanwhile?

      – fl0w

      Feb 26, 2018 at 15:43

    • 3

      worked for me..For the new versions of notepad++ have plugin admin instead of plugin manager

      Jul 30, 2019 at 11:35