Many developers, admins and even AI tools get this wrong. SharePoint Online counts the decoded path length, not the encoded path. The real limit is 400 characters.

Some of the most frequent questions I hear in migrations, meetings, governance workshops, and community forums include:

👉 “How exactly is the SharePoint file path length counted?”

👉 “What’s the maximum file path length in SharePoint Online?”

You’ve probably seen conflicting answers. Some say 260 characters, some say 400, and many insist it’s based on the encoded URL (with %20 for spaces). That’s wrong.

Many people (and even some AI assistants) give the wrong answer; often saying it’s based on the encoded URL length. In reality, SharePoint Online measures the decoded path length.

filepath

Why People Get Confused

What Actually Counts

In SharePoint Online the 400-character limit applies to the decoded path, which includes the site name, document library, folders, subfolders, and file name (without extension) - but not the domain (e.g., https://mytenant.sharepoint.com/).

📐 Example: SharePoint File Path Calculation

browser-display

✅ SharePoint counts the decoded URL: (Spaces / Special Char = 1 character each, total length is reasonable).

https://mytenant.sharepoint.com/sites/YourSiteName/Shared Documents/Project Folder/Sub Folder/Quarterly Report 2025.xlsx

So, the site name, library, folder path, and file name (without extension) all contribute to the total length (83 Char); i.e. - sites/YourSiteName/Shared Documents/Project Folder/Sub Folder/Quarterly Report 2025

❌ Don’t be misled by the encoded URL: (Spaces = %20, "3 characters each", looks much longer.)

https%3A%2F%2Fmytenant.sharepoint.com%2Fsites%2FYourSiteName%2FShared%20Documents%2FProject%20Folder%2FSub%20Folder%2FQuarterly%20Report%202025.xlsx (103 Char)

Best Practices

Real‑World Observation

SharePoint Online counts the decoded path, capped at 400 characters. The real enforcement happens at the total decoded path length (400 characters), not strictly at the segment level.

Here’s where it gets interesting: while the official guidance says “255 characters” for Name metadata or each segment. In practice, file names themselves can go much longer than 255 characters. I’ve tested with a file name of 298 characters - no error, no warning. So yes, long file names can work, as long as the total decoded path stays under 400 characters. That said, I haven’t tested sync behavior. It’s possible OneDrive may still choke on extreme cases, especially during sync or migration.

For safety and consistency, I recommend keeping individual file or folder names under 255 characters, even if SharePoint technically allows more. It’s a practical ceiling that avoids surprises across tools and environments.

📌 Final Takeaway

Forget the encoded path myth 😊