Summary
SharePoint Online and OneDrive enforce specific limits on file and folder names, URL length, and overall path length to ensure files can be synced, accessed, and shared reliably. These limits are based on modern web standards, including URL encoding, which can make paths longer than they appear. Understanding how these limits work, and how everyday naming choices impact them helps prevent sync failures, upload errors (such as 'file path exceeds the limit'), broken links, and issues with Microsoft 365 apps.
This article explains how file and folder names are converted into encoded URLs, how SharePoint and OneDrive file path limits are calculated, which characters should be avoided, and a link to best practices for naming and organizing content in SharePoint Online.
Limits include:
- A maximum file path length of 400 characters for SharePoint and OneDrive, not including the tenant root/domain name (i.e., universitysystemnh.sharepoint.com)
- A single file or folder name limit of 255 characters.
Content
What is a File Path?
A file path is the full address that tells Microsoft 365 exactly where a file or folder lives. In SharePoint Online and in synced folders on your computer, file paths work differently but represent the same structure of site → library → folders → file.
| File Paths in SharePoint Online (Web) |
File Paths in Synced Folders (OneDrive Desktop App) |
|
In the browser, a file path appears as part of the URL. It reflects:
The SharePoint site
The document library
Any nested folders
The file name
Example file path SharePoint Online:
https://universitysystemnh.sharepoint.com/sites/ETS/Shared Documents/Projects/2025/Budget.xlsx
Although it looks like a URL, it represents the logical path of the file within SharePoint’s hierarchy. SharePoint Online enforces limits on total URL length and encodes certain characters
These limits can impact file movement, syncing, and sharing.
|
When a SharePoint library is synced to your computer:
The file path becomes a local Windows/Mac file system path
The structure mirrors the online hierarchy
OneDrive keeps the local and online locations in sync
Example local file path (Windows):
C:\Users\jdoe\OneDrive - USNH\ETS\Projects\2025\Budget.xlsx
Limits apply here as well, particularly the Windows MAX_PATH limit - so very long folder structures can cause sync errors.
|
How the Two Are Related
- The online URL path and the local synced path describe the same file using different formats.
- OneDrive matches them behind the scenes, but each environment has its own rules and character/path limits.
- A path that works in SharePoint Online might still fail when synced if the resulting local path exceeds Windows length limits.
Understanding these differences is crucial when troubleshooting sync issues, long file names, or errors related to file path length.
What is the Limit, and How Are Characters Counted?
- Microsoft’s official limit:
The maximum file path length is 400 characters for SharePoint and OneDrive.
- This limit applies to the path after the tenant root/domain name (i.e., after universitysystemnh.sharepoint.com).
- When sharing or storing the full URL, the entire string—including the tenant root—may be subject to limits in other systems (e.g., hyperlinks in Excel or lists).
- Single file or folder name limit:
The limit for a single file or folder name is 255 characters.
- URL encoding:
Spaces and special characters are encoded (e.g., a space becomes %20, an ampersand becomes %26, and each count as 3 characters). This is why special characters are generally discouraged.
What Is URL Encoding in SharePoint?
When you upload or create files and folders in SharePoint Online, the platform must convert certain characters in the file or folder path into a safe format that can be transmitted over the web. This process is called URL encoding.
Why are URLs Encoded?
Web browsers and web servers can only reliably process a limited set of characters in a URL.
Characters such as spaces, quotes, accented characters, or symbols may be misread or cause errors unless they are converted into a standardized encoded format. SharePoint automatically encodes these characters to ensure the URL remains valid and secure.
Common Encoded Characters
Spaces, pound symbol (#), apostrophes (‘), and ampersands (&), etc. all some examples that become encoded to 3 characters. Non-ASCII characters (é, ä, etc.) are also encoded into longer sequences.
How URL Encoding Relates to File Path Length Limits
SharePoint’s file path length limit (currently 400 characters) applies to the encoded URL, not the visible, friendly name.
This means:
- A file or folder appears to have a short name
- But once encoded, the URL may be significantly longer
- The encoded length counts toward the SharePoint 400-character limit
For example,
| Visible name: |
Encoded name in URL: |
| Café Menu 2024.pdf (17 characters) |
Caf%C3%A9%20Menu%202024.pdf (28 characters) |
Even though the user sees a short file name, SharePoint counts the longer encoded version against the path limit.
Example SharePoint and OneDrive File Paths with Spaces and Characters
| SharePoint Example: |
OneDrive Example: |
|
Original Path:
/sites/USNH Planning Board Committee/Shared Documents/Board Meeting Minutes/FY 25 Planning Session/Agendas & Meeting Minutes/Full meeting minutes.docx
|
Original Path:
/personal/abc123/Documents/USNH Planning Board Committee/Board Meeting Minutes/FY 25 Planning Session/Agendas & Meeting Minutes/Full meeting minutes.docx |
Encoded Path:
/sites/USNH%20Planning%20Board%20Committee/Shared%20Documents/Board%20Meeting%20Minutes/FY%2025%20Planning%20Session/Agendas%20%26%20Meeting%20Minutes/Full%20meeting%20minutes.docx
Character count (encoded path): 180
|
Encoded Path:
/personal/abc123/Documents/USNH%20Planning%20Board%20Committee/Board%20Meeting%20Minutes/FY%2025%20Planning%20Session/Agendas%20%26%20Meeting%20Minutes/Full%20meeting%20minutes.docx
Character count (encoded path): 181 |
Full URL:
https://universitysystemnh.sharepoint.com/sites/USNH%20Planning%20Board%20Committee/Shared%20Documents/Board%20Meeting%20Minutes/FY%2025%20Planning%20Session/Agendas%20%26%20Meeting%20Minutes/Full%20meeting%20minutes.docx
Character count (full URL): 221
|
Full URL: https://universitysystemnh-my.sharepoint.com/personal/abc123/Documents/USNH%20Planning%20Board%20Committee/Board%20Meeting%20Minutes/FY%2025%20Planning%20Session/Agendas%20%26%20Meeting%20Minutes/Full%20meeting%20minutes.docx
Character count (full URL): 225 |
You can see above how dramatically spaces and special characters impact the encoded file path length.
Practical Suggestions for Shortening File Paths
What you can change:
- Shorten subfolder names:
- Board Meeting Minutes → Minutes
- FY 25 Planning Session → FY25
- Agendas & Meeting Minutes → Agendas-Minutes
- Shorten file names:
- Full meeting minutes.docx → Minutes_FY25.docx
- Remove unnecessary folders:
Shortened Example:
| SharePoint Example: |
OneDrive |
New Original path:
/sites/USNH Planning Board Committee/Shared Documents/Minutes/FY25/Agendas-Minutes/Minutes_FY25.docx
|
New Original path: /personal/abc123/Documents/USNH Planning Board Committee/Minutes/FY25/Agendas-Minutes/Minutes_FY25.docx |
New Encoded path:
/sites/USNH%20Planning%20Board%20Committee/Shared%20Documents/Minutes/FY25/Agendas-Minutes/Minutes_FY25.docx
Character count (encoded path): 108
Characters saved: 72
|
New Encoded path:
/personal/abc123/Documents/USNH%20Planning%20Board%20Committee/Minutes/FY25/Agendas-Minutes/Minutes_FY25.docx
Character count (encoded path): 109
|
New Full URL: https://universitysystemnh.sharepoint.com/sites/USNH%20Planning%20Board%20Committee/Shared%20Documents/Minutes/FY25/Agendas-Minutes/Minutes_FY25.docx
Character count (full URL): 149
|
New Full URL:
https://universitysystemnh-my.sharepoint.com/personal/abc123/Documents/USNH%20Planning%20Board%20Committee/Minutes/FY25/Agendas-Minutes/Minutes_FY25.docx
Character count (full URL): 153
|
Tip:
Focus on subfolders and file names you control. Even small changes can make a big difference, especially for files stored deep in a folder structure.
Further Readings
M365: Naming Conventions and Best Practices for Files and Folders
Restrictions and limitations in OneDrive and SharePoint
Need additional help?
For assistance concerning site creation, content sharing, file synchronization, or other common SharePoint, OneDrive, Teams, or Office app activities, we recommend our Microsoft 365 Learning sites:
Learn more about the great tools our Microsoft 365 Learning sites offer!
Visit the Technology Help Desk Support page to locate your local campus contact information or to submit an online technology support request. For password issues you must call or visit the Help Desk in person.