What is the maximum number of characters allowed in a Windows filename (excluding path)?

The story behind the answer

The maximum filename length on Windows NTFS is 255 characters, excluding the path.

NTFS stores a filename in up to 255 UTF-16 code units. That limit applies to the individual name component—the part between directory separators—not to the complete address of a file. Long directory names can therefore consume much of the available total path length while leaving the filename limit unchanged.

A frequent mix-up is 260, the traditional MAX_PATH limit associated with many Windows APIs. That figure concerns the full path, including drive or UNC information and separators, rather than just the filename. It is also subject to modern Windows settings and application support, so it should not be treated as the NTFS filename limit.

The limit is filesystem-oriented: NTFS supports 255 UTF-16 code units, and unusual characters such as some emoji may occupy more than one code unit. Windows also reserves certain characters and device names, so a name can be short enough yet still invalid.

Source: Wikipedia · fact-checked Sept. 2026

Add question to a list

Choose a list to keep this question in: