288

The current version of Notepad++ (at the time of this writing) is 6.6.3. Version 6.5.2 is the first that introduced a native (without a plugin) sorting function. At least, that's what they claim; even though we're nine releases after version 6.5.2, I have found nothing about this feature:

  • There is no sign of it in the menu (or I am blind),
  • There isn't even a word in Notepad++ documentation (online help).

Everything I read around the Internet (including this answer) still talks about sorting lines using the TextFX plugin. There isn't anything about a native (QuickSort-based) function.

So: How do I sort lines in Notepad++ without using the TextFX plugin?

Peter Mortensen
  • 12,090
  • 23
  • 70
  • 90
trejder
  • 10,821
  • 18
  • 59
  • 117

1 Answers1

442

The proper menu option is as follows.

For all versions prior to 6.8.3:

Menu EditLine OperationsSort Lines in Ascending / Descending Order

For version 6.8.3 and following:

Menu EditLine OperationsSort Lines Lexicographically Ascending / Descending

Sort lines lexicographically

Select a few lines to sort just the selection. If there's no selection, your entire file will be sorted.

Greenonline
  • 2,235
  • 11
  • 24
  • 30
trejder
  • 10,821
  • 18
  • 59
  • 117
  • 6
    Can't believe I've used Notepad++ for this long without knowing about this! – Jay Cummins Aug 03 '16 at 13:58
  • 10
    For some weird reason this didn't work for me. I'm on Windows but my text had LF line endings only (text pasted from browser). To work around it I had to convert all Line endings to Unix, then back to Windows, then the sort worked. – pgr Jan 26 '17 at 12:51
  • @pgr Notepad++ sorting mechanism should work on any line ending. If you can reproduce this behavior then this may classify as a bug. – trejder Jan 27 '17 at 18:39
  • 1
    @trejder The fact that I had to convert one way and then back tells me the real problem is Notepad++'s realization of what kind of document it's working with. Maybe pasted text that hasn't been saved yet is an edge case. But it's definitely a bug, yes. – pgr Jan 28 '17 at 10:33
  • This worked for me with 7.3.3. However, had to do Edit > Convert CASE to > lowercase as the first step. Used the feature to sort a huge list of email addresses, so not a case-sensitive scenario. – Razvan Zoitanu May 17 '17 at 15:56
  • 4
    The next question could be [whether it is possible to sort in a case-insensitive way](https://stackoverflow.com/questions/23606753)... – Peter Mortensen Jul 20 '18 at 12:50
  • Not working for me! – Black Sep 10 '18 at 07:57
  • @PeterMortensen The next goof question could be, why you asked that question on Stack Overflow, not on Super User? :> – trejder Sep 11 '18 at 06:14
  • 2
    The sort function is not working correctly, it sorts like this: addCartLink bindPager setItemsTitle addTab – Black Oct 09 '18 at 14:10
  • 1
    As of 7.5.9, this function is flat out broken and does nothing on my lines. – Collin Chaffin Feb 04 '19 at 13:18
  • 1
    I noticed that the sort function only works when lines are separated by both a Carriage Return and Line Feed, in that order. Using only one or the other will not allow for sorting, probably because Notepad thinks it's all one line. – Tharkon May 21 '19 at 11:31
  • 1
    V7.8.1 still works, , but french menu are "Édition/Ligne/Trier les lignes ..." – pdem Dec 12 '19 at 08:07
  • @Tharkon AFAIK Notepad++ supports all three line endings (Windows, Linux and Mac) so it is hard for me to believe that they have designed sorting function for only one of them. But I haven't got chances to test this, sorry. – trejder Dec 12 '19 at 08:57
  • Using the current version v7.8.5 I had to save the file, close and and reopen it so that I get the correct order. So apparently you shouldn't make any change to the file after opening it for the function to work correctly! – Name Jun 22 '20 at 21:14
  • Not working in 7.8.9 . Where is TextFX??? – Kux Oct 29 '20 at 05:09