The short answer

Two limits apply to a OneDrive file. They do not come from the same place and do not have the same consequences:

LimitSourceConsequence
400 charactersOneDrive, OneDrive for work or school and SharePoint in Microsoft 365: the entire path, including the file name🔴 The file cannot be synced (the "file path is too long" error).
255 charactersWindows ("MAX_PATH" limit: 260 characters in total, drive letter and terminating character included)⚠️ The file syncs, but Windows and some applications cannot open it from File Explorer.

Why you read 255, 256 or 260

The number varies depending on what is counted: the drive letter (C:\), the terminating character Windows adds, or the file name only. The official Windows limit is 260 characters, terminating character included. OneDrive Path Checker flags paths over 255 characters as warnings and paths over 400 characters as critical.

What counts toward the length

Can the limit be raised?

Not the 400-character limit of OneDrive and SharePoint. The Windows limit (260 characters in total), however, can be lifted for compatible applications from Windows 10 (version 1607): long path support must be enabled in the Registry (the LongPathsEnabled value) or with the "Enable Win32 long paths" group policy, with administrator rights. Not every application supports it, and it does not change OneDrive's 400-character limit.

The simplest fix is still to shorten paths: move folders closer to the root and remove repetitions from names.

Check your files

Hunting for these paths by hand across thousands of folders is unrealistic. OneDrive Path Checker scans a OneDrive folder in seconds and lists files over 255 characters (warnings) and over 400 characters (critical), with the number of excess characters. You rename them from the application, then export a PDF or CSV report.