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.
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 insideHKEY_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.mscby default. If you use a Home edition, skip directly to the Registry Editor or Command Prompt procedures below.
- Windows 10 and Windows 11 Pro, Enterprise, and Education include the Local Group Policy Editor (
- Dual policy scope (
HKLMvs.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 hasNoStrCmpLogicalset to1, 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.
- Press
Win + Ron your keyboard to open the Run dialog. - Type
gpedit.mscand click OK (or pressEnter). If prompted by User Account Control (UAC), click Yes. - 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 - In the right pane, locate the policy setting named Turn off numerical sorting in File Explorer.
- 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, 2sorting. - Double-click Turn off numerical sorting in File Explorer, select Not Configured (or Disabled to explicitly enforce numerical sorting), and click OK.
- Because the policy name is phrased as a negative (Turn off...), setting it to Enabled turns numerical sorting off and forces literal
- 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 - In the right pane, locate Turn off numerical sorting in File Explorer.
- If its state is Enabled, double-click the policy, select Not Configured (or Disabled), and click OK.
- Close the Local Group Policy Editor.
- 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 exactNoStrCmpLogicalvalue specified below. Back up theExplorerpolicy key before making changes by right-clicking the key in the left pane and selecting Export.
Check and Clear the Current User Policy Key
- Press
Win + R, typeregedit, and pressEnter. Click Yes at the User Account Control prompt. - 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 theExplorersubkey does not exist underPolicies, no user-level override is present; proceed to the Local Machine check below.) - Look in the right pane for a
REG_DWORDvalue namedNoStrCmpLogical.- Value data
1disables numerical sorting and causes1, 10, 2literal ordering. - Value data
0(or the absence of the value) enables default1, 2, 10numerical sorting.
- Value data
- Right-click
NoStrCmpLogicaland select Delete, then click Yes to confirm. Alternatively, double-clickNoStrCmpLogical, change Value data to0, and click OK.
Check and Clear the Local Machine Policy Key
- 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 - Look in the right pane for
NoStrCmpLogical. - If
NoStrCmpLogicalis present and set to1, right-clickNoStrCmpLogical, click Delete, and click Yes to confirm (or double-click it and set Value data to0). - 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 theExplorerkey if it does not exist), right-click in the right pane, select New > DWORD (32-bit) Value, name itNoStrCmpLogical, and set its Value data to1.
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.
- Press
Win + S, typecmd, right-click Command Prompt in the search results, and select Run as administrator. Click Yes at the UAC prompt. - Run the following two commands to check whether
NoStrCmpLogicalexists 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 literal1, 10, 2sorting.
- If a command returns
- 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
- Save any unfinished file copy operations, then press
Ctrl + Shift + Escto 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).
- Your taskbar and desktop icons will briefly disappear and reload.
Verify Numerical Sorting
- Open File Explorer (
Win + E) and create a temporary test folder (or navigate to the folder where sorting failed). - Create or inspect three test files named
file1.txt,file2.txt, andfile10.txt. - 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.
- Confirm that the files now appear in numerical order:
file1.txtfile2.txtfile10.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 group00, 0a, 0b, 01, 1a, 1bbecause0and0are 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-10vsfile1):
Windows' underlying linguistic string comparison ignores hyphens (-) and apostrophes (') during the primary pass and evaluates spaces before alphanumeric characters. TheNoStrCmpLogicalpolicy 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-writeHKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoStrCmpLogicalwhenever policies refresh. Runrsop.msc(Resultant Set of Policy) orgpresult /h gpreport.htmlfrom 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.