We have a SharePoint online tenant, and i need to know what is the maximum length of the folders/sub-folders and file we can have, is there is any? for example can i add a file inside this path:-

>>Main folder >> Sub folder1 >> ...sub folder100 >> Filename.txt ?

2 Answers 2


The maximum length is 400 encoded characters in the URL. There is no restriction on the number of folders/subfolders given it doesn't exceed this limit.

Invalid file names and file types in OneDrive, OneDrive for Business, and SharePoint

  • thank for the reply, but i were reading this article social.technet.microsoft.com/Forums/ie/en-US/… and it says that the maximum for any folder path is 128?
    – John John
    Commented May 3, 2020 at 15:45
  • Even that is incorrect, in SharePoint Server 2016 the limit is 260 characters. SPO/SharePoint Server 2019 use the 400 character limit, per the official article.
    – user6024
    Commented May 3, 2020 at 15:46
  • Actually, the linked article says (at least now) that the maximum DECODED file path is 400 characters (with caveats about which part of the path are included). There is no mention of the length of encoded path length. Commented Sep 9, 2021 at 19:25

It's easy to google for the limit and find out that it is 400 decoded characters. But it's not clear what this means. So...

A simple explanation:

The highlighted part of the URL below, must be at most 400 characters. And by the way everything that looks like one character counts as one character.

somecompany.sharepoint.com/Some%20Site/Some-Subsite/Some-Document-Library/Forms/AllItems.aspx?id=%2FA folder/some subfolder/And some text with non Latin, non ASCII, ελληνικούς χαρακτήρες&viewid=f821a73a-95c5-4ae3-b474-982c674b7dcb

More details and technical information

Note that if you copy paste the URL your browser may mangle it (URL encode it). Copy just this part and it will leave it untouched.

We count Unicode(decoded) characters (not ASCII characters after UTF-8 encoding, neither ASCII characters after URL encoding nor anything similar). I tested this assumption by first hitting the limit with ASCII characters and then changing some of them to Greek characters.

Finally, note that during my tests I actually reached 401 characters.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.