The behaviour described below occurs on Windows-7 systems and on Windows XP. We operate in a dual-language environment - English and Hebrew.

When in Windows Explorer we sort files by name, the order in which they are listed is not what we would expect. Here is a list of file names as sorted by Windows Explorer (all of the files have a .pdf suffix):


enter image description here

It looks to me that first the items are sorted according to the position of the first alphabetic character in the name, and then, within those groups, they are sorted in "normal" alpha-numeric order.

That is, all the files with an alpha character in the first position are on top of the list, followed by those with the first alpha character in the second position, followed by those with the first alpha character in the third position, and so on.

An alternate way of looking at this is that, in a file name composed of numbers and letters, the sort treats the first group of numbers in the name as the major sort node, with the rest of the name being the secondary sort node.

Now that I understand the sequencing logic, it's not a big problem, but I was wondering why this happens?

  • Yes it sorts numbers by numeric value and not character by character. In a list of files named by numbers it looks more natural to have 5.txt before 400.txt.
    – Brian
    Apr 23 '12 at 12:23
  • 1
    See here: support.microsoft.com/kb/319827
    – user140786
    Jun 18 '12 at 4:53
  • @davebaldwin can you please post it as an answer?
    – Aprillion
    Jul 11 '12 at 7:52
  • @deathApril, he already did, but it was a link-only post, so it was deleted and converted to a comment.
    – Synetech
    Sep 29 '12 at 17:49
  • 1
    @Haim, it’s happening because 101 AC050 > 29 AAC050 > 19 C100H > 1 G110033H.
    – Synetech
    Sep 29 '12 at 17:56

By default, the newer sort order considers strings in file and folder names as numeric content, not text. Numerals in folder and file names are sorted according to their numeric value.

In the following example, note how the following files, whose names contain numerals, are sorted.

Windows Vista, Windows XP, and Windows Server 2003


In this example, 88 is a numerically higher value than 5. Therefore, the 88.txt is listed after the 5.txt when you sort the folders by name in ascending order.

Source: The sort order for files and folders whose names contain numerals is different in Windows Vista, Windows XP, and Windows Server 2003 than it is in Windows 2000

  • 3
    Seems like your example is vacuous. Wouldn't something that starts with 8 always come after something that starts with 5, regardless of numeric versus textual sort order? Aug 20 '17 at 0:03

In brief:

Add key HKLM\Software\Microsoft\Windows\Currentversion\Policies\Explorer

Set DWORD value NoStrCmpLogical to 1

Restart your explorer windows



If you prefer to use Group Policy (as opposed to manual editing of the registry) to turn off the numerical sorting option in Windows File Explorer, you can use the Group Policy Editor (gpedit.msc) to modify one of the following policy items (i.e., for a particular user or for the entire machine):

> Computer Configuration   (or...   User Configuration)
        > Administrative Templates
                > Windows Components
                        > File Explorer
                                • Turn off numerical sorting in File Explorer

(from the Windows 10 policy item metadata)
This policy setting allows you to have file names sorted literally (as in Windows 2000 and earlier) rather than in numerical order. If you enable this policy setting, File Explorer will sort file names by each digit in a file name (for example, 111 < 22 < 3). If you disable or do not configure this policy setting, File Explorer will sort file names by increasing number value (for example, 3 < 22 < 111).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.