Sharepoint file path length - encoded or decoded?

Rick Lecoat 25 Reputation points
2024-07-31T16:07:19.6133333+00:00

I'm trying to understand how to calculate the path length of a file in SharePoint. I know that the limit is 400 characters. However, I'm unclear on what counts toward that total, and whether characters are counted encoded or decoded.

For example:

If the URL was https://company.sharepoint.com/FolderName/MyFile.doc (not a real SharePoint URL format, I know), would that be counted as 52 characters (the number of characters in the example above)?

OR: would it be counted as 62 characters (the number of chars in the URL https%3A%2F%2Fcompany.sharepoint.com%2FFolderName%2FMyFile.doc where special characters have been URL encoded)?

I've been googling this for days and just keep finding conflicting information. Can somebody give a definitive answer? TIA.

Microsoft 365 and Office | SharePoint | For business | Windows
0 comments No comments
{count} vote

Answer accepted by question author
  1. Ling Zhou_MSFT 23,670 Reputation points Microsoft External Staff
    2024-08-01T01:41:12.5+00:00

    Hi @Rick Lecoat,

    Thank you for posting in this community.

    According to Microsoft's official documentation, the path length of a file is calculated based on decoding.

    User's image

    For more information on file path lengths, see Part File name and path lengths of this article: Restrictions and limitations in OneDrive and SharePoint.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Virendra Kumar 0 Reputation points
    2025-12-10T22:01:39.28+00:00

    How SharePoint Online File Path Length is Counted

    • Decoded Path Length (the real limit): SharePoint Online enforces a 400‑character limit on the decoded path.
    • That means spaces, special characters, folder and file names are counted as they appear in plain text, not in their encoded %20 or %2F form.
    • What Counts Toward the Limit: 
    • ✅ Site name (after the domain)
    • ✅ Document library name
    • ✅ Folder and subfolder names
    • ✅ File name
    • What Does Not Count: 
    • ❌ The domain (https://tenant.sharepoint.com/)
    • ❌ File extension (e.g., .docx.xlsx)

    Example

    https://tenant.sharepoint.com/sites/ProjectX/SharedDocuments/2025/Design/Blueprints/Final Draft v2.docx

    • Count starts after sites/ProjectX/
    • Includes: Shared Documents/2025/Design/Blueprints/Final Draft v2
    • Excludes: https://tenant.sharepoint.com/ and .docx

    If that decoded string exceeds 400 characters, the file won’t upload, sync or migrate properly.

    SharePoint Online’s file path limits are often misunderstood. Below article breaks down what actually counts toward the 400?character limit, clears up common myths, and shows practical ways to count length. Whether you’re an admin or end user, you’ll learn how to manage paths effectively and keep your files accessible.

    Confused About SharePoint Online File Path Limits? Here’s What You Should Really Count

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.