SharePoint file path too long: limits, causes and fixes
SharePoint and OneDrive allow paths up to 400 characters, but Windows apps often stop at 260. See which limit applies, how to measure a path and how to shorten it.
The problem
A path is every folder in the hierarchy plus the file name and its extension. Each character counts, including spaces and separators.
There is no single path limit. SharePoint and OneDrive accept long paths in the cloud, but the same file can be too long for File Explorer or an Office desktop app once it syncs to a Windows PC. In practice the lowest limit along the way decides whether the file works.
Path length limits by app
| Where | Limit | What it means |
|---|---|---|
| OneDrive and SharePoint (cloud) | 400 characters | The entire decoded path, including the file name. A space counts as one character, not as %20. |
| Office for the web | 400 characters | Same limit as the cloud. |
| OneDrive sync app | 520 characters | Local path up to 400 characters plus a OneDrive root folder path up to 120. |
| Windows File Explorer | 260 characters | Opening, renaming and moving files. |
| Office desktop apps on Windows | 256 characters | Files with longer paths cannot be opened. |
| macOS Finder | 1,024 characters | Office apps on macOS: 1,024 UTF-8 bytes. |
In SharePoint, the path includes the site and library portion of the address as well as every folder. Windows can be configured to allow paths up to 32,767 characters, but many apps, including File Explorer, still use the 260-character limit.
Symptoms
- A synced file cannot be opened in Word, Excel or PowerPoint, although it opens in the browser.
- File Explorer refuses to copy, move or rename a file deep in a folder tree.
- Windows reports that the action can’t be completed because the folder or a file in it is open in another program, even when nothing is open.
- A file or folder refuses to upload to SharePoint after it has been moved into a deeper folder.
The action can’t be completed because the folder or a file in it is open in another program.
Causes
Deep folder structures
Every level adds its name and a separator. Ten nested folders with descriptive names easily pass 260 characters.
Long site and library names
In SharePoint the site and library names count too, so the same folder can be fine in one site and too long in another.
Long local sync roots
A synced library lives under a folder such as C:\Users\name\Organization name\Site - Library, which uses part of the local limit before your own folders start.
Moving content into a deeper location
Paths that were short on a file server become long once they are placed several levels down in a new library.
How to fix it
-
Measure a single path
Copy the full path from the File Explorer address bar and check its length in PowerShell.
("C:\path\to\your\file.docx").Length -
List every long path in a folder
This read-only command lists items whose full local path is longer than 250 characters, longest first. Run it in PowerShell 7 for the most reliable results with very long paths. Use $env:OneDrive for a personal account.
Get-ChildItem -LiteralPath $env:OneDriveCommercial -Recurse -Force -ErrorAction SilentlyContinue | Where-Object { $_.FullName.Length -gt 250 } | Sort-Object { $_.FullName.Length } -Descending | Select-Object @{ n = 'Length'; e = { $_.FullName.Length } }, FullName -
Shorten names near the top first
Renaming a top-level folder shortens every path below it. Shorten a few high-level folder names before renaming individual files.
-
Flatten the structure
Move frequently used folders closer to the root of the library, and replace deep hierarchies with fewer, broader folders.
-
Rename from the browser when Windows refuses
If File Explorer cannot rename an item because its path is too long, rename it in OneDrive or SharePoint in your browser, where the 400-character limit applies. The change syncs back to your PC.
Before you change anything
- Renaming or moving folders changes shared links, shortcuts and links between files.
- Enabling Windows long path support is a system-wide change for administrators and does not fix the limit in File Explorer or Office desktop apps.
- Agree on a folder structure with your team before restructuring a shared library, so people are not working in old paths.
When OneDriveSyncFixer helps
Microsoft documentation
- What are the file path length limits? (opens in a new tab)support.microsoft.com
- Restrictions and limitations in OneDrive and SharePoint (opens in a new tab)support.microsoft.com
This guide summarizes Microsoft’s published guidance in our own words. Microsoft documentation remains the authoritative source.
Related guides
Keep troubleshooting
-
How to fix invalid file names in OneDrive
OneDrive and SharePoint skip any file or folder whose name breaks their naming rules. Learn the rules, find the affected items and rename them without breaking links.
-
SharePoint library won’t sync: causes and fixes
Troubleshoot SharePoint libraries that will not sync with the OneDrive app: a missing Sync button, read-only libraries, credentials, conflicts and the naming and size rules.
-
OneDrive not syncing on Windows: a step-by-step checklist
Work through the usual reasons OneDrive stops syncing, in order: sign-in, paused sync, storage, problem files, app version and finally a reset.