Try XML Tools. 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.
Answer from erjiang on Stack OverflowVideos
Try XML Tools. 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.
You need to install XML Tools from the Plugins menu item → Plugins Admin... → Plugins Admin dialog appears and then scroll to bottom of available plugins and check XML Tools, install it and then Ctrl + Alt + Shift + B OR the option for XML Tools above shows up.
Use JSTool
As of Notepad++ v7.6, you can use the Plugin Admin option in Notepad++ to install JSTool.
Manual Install
- Download it from https://www.sunjw.us/jstool/npp/#download
- Copy JSMinNpp.dll to the plugin directory of Notepad++. You may need to create a directory named "JSMinNPP" in the plugin directory after version 7.6.3
Here's an example of JSON that's been formatted using the tool:
{
"menu" : {
"id" : "file",
"value" : "File",
"popup" : {
"menuitem" : [{
"value" : "New",
"onclick" : "CreateNewDoc()"
}, {
"value" : "Open",
"onclick" : "OpenDoc()"
}, {
"value" : "Close",
"onclick" : "CloseDoc()"
}
]
}
}
}

Tip: Select the code you want to reformat, then Plugins | JSTool | JSFormat.
You can use JSON Viewer. For Notepad++ v.7.6+, Plugins Admin... is available to install it:
- Open the Menu option "Plugins" -> "Plugins Admin..."
- Search for "JSON Viewer"
- Check JSON Viewer in List
- Click on Install Button
- Restart Notepad++
- Select JSON text
- Go to "Plugins" > "JSON Viewer" > "Format JSON ( Ctrl + Alt + Shift + M )"
Since I upgraded to 6.3.2, I use XML Tools.
- install XML Tools via the Plugin Admin (Plugins → Plugins Admin... Then search for "XML Tools", check its box and click the "Install" button).
- use the shortcut Ctrl+Alt+Shift+B (or menu → Plugins → XML Tools → Pretty Print)


In older versions: menu → TextFX → HTML Tidy → Tidy: Reindent XML.
Install Tidy2 plugin. I have Notepad++ v6.2.2, and Tidy2 works fine so far.

