When File Explorer lists numbered files in literal character order—placing file10.txt before file2.txt—Windows' built-in numerical sorting has been turned off by a Local Group Policy setting or a registry policy override. By default, all modern versions of Windows (including Windows 10 and Windows 11) use numerical sorting via the StrCmpLogicalW shell comparison rule, which evaluates contiguous digits in filenames as whole numbers (1, 2, 10) rather than comparing them character-by-character (1, 10, 2). You can restore natural numerical sorting by setting the Turn off numerical sorting in File Explorer policy back to Not Configured or Disabled in the Local Group Policy Editor, or by deleting the NoStrCmpLogical DWORD value from the Policies\Explorer registry keys and restarting the Windows Explorer process.

A Windows File Explorer graphic contrasts natural filename sorting with the incorrect order that places file10.txt before file2.txt. Prerequisites and Edition Compatibility​

Before modifying sorting policies, review how Windows applies these rules across different editions and user scopes:

  • Administrator privileges: Changing Local Group Policy or modifying keys inside HKEY_LOCAL_MACHINE (and policy subkeys inside HKEY_CURRENT_USER) requires an account with local administrator rights.
  • Windows edition support:
    • Windows 10 and Windows 11 Pro, Enterprise, and Education include the Local Group Policy Editor (gpedit.msc) as well as the Registry Editor (regedit.exe).
    • Windows 10 and Windows 11 Home do not include gpedit.msc by default. If you use a Home edition, skip directly to the Registry Editor or Command Prompt procedures below.
  • Dual policy scope (HKLM vs. HKCU): The numerical sorting policy can be enforced at the computer level (affecting every user on the PC) or the user level (affecting only the currently signed-in account). If either scope has NoStrCmpLogical set to 1, literal sorting (1, 10, 2) remains active. You must check both scopes to make sure one is not overriding the other.

Restore Numerical Sorting via Local Group Policy Editor​

If you are running Windows 10 or Windows 11 Pro, Enterprise, or Education, use the Local Group Policy Editor to inspect both the Computer Configuration and User Configuration nodes.

  1. Press Win + R on your keyboard to open the Run dialog.
  2. Type gpedit.msc and click OK (or press Enter). If prompted by User Account Control (UAC), click Yes.
  3. In the left pane of the Local Group Policy Editor, navigate to the computer-wide policy path:
    Computer Configuration > Administrative Templates > Windows Components > File Explorer
  4. In the right pane, locate the policy setting named Turn off numerical sorting in File Explorer.
  5. Check the State column next to the policy:
    • Because the policy name is phrased as a negative (Turn off...), setting it to Enabled turns numerical sorting off and forces literal 1, 10, 2 sorting.
    • Double-click Turn off numerical sorting in File Explorer, select Not Configured (or Disabled to explicitly enforce numerical sorting), and click OK.
  6. Next, check the per-user policy path in the left pane to ensure a user-level rule is not overriding the machine setting:
    User Configuration > Administrative Templates > Windows Components > File Explorer
  7. In the right pane, locate Turn off numerical sorting in File Explorer.
  8. If its state is Enabled, double-click the policy, select Not Configured (or Disabled), and click OK.
  9. Close the Local Group Policy Editor.
  10. Open a Command Prompt or Run dialog, run gpupdate /force, and then restart the File Explorer shell using the steps in the Restart File Explorer and Verify the Sort Order section below.

Restore Numerical Sorting via Registry Editor​

If you use Windows 10 or Windows 11 Home—or if a registry tweak utility, third-party file manager tool, or .reg script wrote the policy directly to the Windows Registry without showing up as configured in gpedit.msc—remove or reset the NoStrCmpLogical value directly.

Warning: Editing the Windows Registry incorrectly can cause system instability or break shell settings. Only modify or delete the exact NoStrCmpLogical value specified below. Back up the Explorer policy key before making changes by right-clicking the key in the left pane and selecting Export.

Check and Clear the Current User Policy Key​

  1. Press Win + R, type regedit, and press Enter. Click Yes at the User Account Control prompt.
  2. In the address bar at the top of Registry Editor, paste the following path and press Enter:
    HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer
    (Note: If the Explorer subkey does not exist under Policies, no user-level override is present; proceed to the Local Machine check below.)
  3. Look in the right pane for a REG_DWORD value named NoStrCmpLogical.
    • Value data 1 disables numerical sorting and causes 1, 10, 2 literal ordering.
    • Value data 0 (or the absence of the value) enables default 1, 2, 10 numerical sorting.
  4. Right-click NoStrCmpLogical and select Delete, then click Yes to confirm. Alternatively, double-click NoStrCmpLogical, change Value data to 0, and click OK.

Check and Clear the Local Machine Policy Key​

  1. While still in Registry Editor, paste the following path into the address bar and press Enter:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer
  2. Look in the right pane for NoStrCmpLogical.
  3. If NoStrCmpLogical is present and set to 1, right-click NoStrCmpLogical, click Delete, and click Yes to confirm (or double-click it and set Value data to 0).
  4. Close Registry Editor and proceed to restart the Windows Explorer process.

Rollback: How to Re-Enable Literal (1, 10, 2) Sorting​

If you work with hexadecimal folder names, strict ASCII/Unicode data exports, or legacy naming conventions where you intentionally want file10 listed before file2, you can reverse this change at any time:

  • In Group Policy: Set Turn off numerical sorting in File Explorer to Enabled.
  • In Registry Editor: Navigate to HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer (create the Explorer key if it does not exist), right-click in the right pane, select New > DWORD (32-bit) Value, name it NoStrCmpLogical, and set its Value data to 1.

Alternate Method: Query and Reset via Elevated Command Prompt​

If you want to inspect both registry hives at once and clear any active overrides without navigating through Registry Editor menus, use the built-in reg.exe utility from an elevated Command Prompt.

  1. Press Win + S, type cmd, right-click Command Prompt in the search results, and select Run as administrator. Click Yes at the UAC prompt.
  2. Run the following two commands to check whether NoStrCmpLogical exists in either hive:
    Code:
    reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v NoStrCmpLogical
    reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v NoStrCmpLogical
    • If a command returns ERROR: The system was unable to find the specified registry key or value, that hive is clean.
    • If a command returns NoStrCmpLogical REG_DWORD 0x1, that hive is actively forcing literal 1, 10, 2 sorting.
  3. To delete the override from both hives and immediately restart the Explorer shell in one sequence, run:
    Code:
    reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v NoStrCmpLogical /f
    reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v NoStrCmpLogical /f
    taskkill /f /im explorer.exe & start explorer.exe

Restart File Explorer and Verify the Sort Order​

Changes to NoStrCmpLogical or the corresponding Group Policy do not update open File Explorer windows immediately. The Windows shell caches this policy when explorer.exe starts, so you must either restart the Windows Explorer process or sign out and sign back in.

Restart the Windows Explorer Process​

  1. Save any unfinished file copy operations, then press Ctrl + Shift + Esc to open Task Manager.
    • On Windows 10: If Task Manager opens in compact mode, click More details at the bottom. Stay on the Processes tab, scroll down to Windows Explorer, right-click it, and select Restart (or select it and click Restart in the bottom-right corner).
    • On Windows 11: In the left navigation sidebar, click Processes (the four-square grid icon). Locate Windows Explorer in the list (or use the top search bar to type explorer), right-click Windows Explorer, and click Restart (or click Restart task at the top of the window).
  2. Your taskbar and desktop icons will briefly disappear and reload.

Verify Numerical Sorting​

  1. Open File Explorer (Win + E) and create a temporary test folder (or navigate to the folder where sorting failed).
  2. Create or inspect three test files named file1.txt, file2.txt, and file10.txt.
  3. Set the folder view to Ascending Name order:
    • On Windows 11: Click Sort on the top command bar, verify Name is checked, and verify Ascending is checked.
    • On Windows 10: Click the View tab on the top ribbon, click Sort by in the Current view group, and ensure Name and Ascending are selected.
  4. Confirm that the files now appear in numerical order:
    • file1.txt
    • file2.txt
    • file10.txt

Troubleshooting Common Sorting Failures​

If your files still appear in the wrong order after clearing NoStrCmpLogical and restarting explorer.exe, check these specific failure modes:

  • The folder is sorted by a column other than Name (or sorted Descending):
    Switch the folder to Details view (Ctrl + Shift + 6). Look at the column headers at the top of the file list. The upward-pointing chevron arrow (^) must be on the Name column. If the arrow points down (v), File Explorer is sorting in Descending order (file10, file2, file1). If the arrow appears on Date modified, Type, or Title, click the Name column header once to sort by Name ascending.
  • Group by is splitting the folder into separate sections:
    If some numbered files appear near the top of the folder and others appear lower down under collapsible headers, Grouping is enabled.
    • Windows 11: Click Sort > Group by > (None).
    • Windows 10: Go to the View tab, click Group by, and select (None).
  • Hexadecimal filenames (0a, 0b, 1a) still sort unexpectedly:
    When numerical sorting is enabled (the Windows default), File Explorer parses only decimal digits (0–9) as numbers and treats hexadecimal letters (a–f) as text suffixes. As a result, a folder containing two-character hex names will group 00, 0a, 0b, 01, 1a, 1b because 0 and 0 are both evaluated as the numeric value zero before comparing the trailing characters. If you are sorting hexadecimal strings or GUIDs, you must disable numerical sorting (NoStrCmpLogical = 1) or prefix non-numeric characters consistently.
  • Hyphens, apostrophes, and spaces cause unexpected ordering (file-10 vs file1):
    Windows' underlying linguistic string comparison ignores hyphens (-) and apostrophes (') during the primary pass and evaluates spaces before alphanumeric characters. The NoStrCmpLogical policy only controls how contiguous digits (0–9) are compared; it does not turn File Explorer into a raw ASCII ordinal sorter for punctuation. To avoid inconsistent sorting with punctuation, use underscores (_) instead of hyphens, or zero-pad numbers (file_001.txt, file_002.txt, file_010.txt) so filenames sort identically across all sorting modes and operating systems.
  • Domain Group Policy or a third-party view utility re-applies the registry value:
    On work or school PCs joined to Active Directory or managed by Microsoft Intune, an administrator policy may re-write HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoStrCmpLogical whenever policies refresh. Run rsop.msc (Resultant Set of Policy) or gpresult /h gpreport.html from an elevated Command Prompt to check whether a domain Group Policy Object (GPO) is enforcing Turn off numerical sorting in File Explorer. On personal PCs, if you use folder-view customization tools such as WinSetView, make sure the Disable numerical sort option is unchecked inside the tool before re-applying its defaults.