Fixity Labs

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.

Updated
Reading time
3 min
Applies to
SharePoint in Microsoft 365, OneDrive for work or school, OneDrive for Windows

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

WhereLimitWhat it means
OneDrive and SharePoint (cloud)400 charactersThe entire decoded path, including the file name. A space counts as one character, not as %20.
Office for the web400 charactersSame limit as the cloud.
OneDrive sync app520 charactersLocal path up to 400 characters plus a OneDrive root folder path up to 120.
Windows File Explorer260 charactersOpening, renaming and moving files.
Office desktop apps on Windows256 charactersFiles with longer paths cannot be opened.
macOS Finder1,024 charactersOffice 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.
Message you may see

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

  1. 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
  2. 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
  3. 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.

  4. Flatten the structure

    Move frequently used folders closer to the root of the library, and replace deep hierarchies with fewer, broader folders.

  5. 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

This guide summarizes Microsoft’s published guidance in our own words. Microsoft documentation remains the authoritative source.

Related guides