# what is maximum number of characters allowed in filename?

**URL:** https://community.mp3tag.de/t/what-is-maximum-number-of-characters-allowed-in-filename/10690
**Category:** General Discussion
**Created:** [August 22, 2010, 7:15pm UTC](https://community.mp3tag.de/t/what-is-maximum-number-of-characters-allowed-in-filename/10690 "2010-08-22T19:15:01Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [August 23, 2010, 1:55am UTC](https://community.mp3tag.de/t/what-is-maximum-number-of-characters-allowed-in-filename/10690/4 "2010-08-23T01:55:28Z")

</div>

> [@dsj777](#):
>
> Yes, I read that previously, and I believe I understand what it says about Microsoft's limits. I'm interested in learning details about Mp3tag's limits, because Mp3tag appears to have lower limits.
> 
> To put it another way, my experience is that Mp3tag's limits are less than the smallest limit in Microsoft's Windows API environment, which is MAX\_PATH less an 8.3 name, which equals 260 - 12, which equals 248. I have many files with combined directory path and filename characters less than 248 characters that Mp3tag forced me to shorten.
> 
> I'm no expert in this space, which is why I posted this question, but I would guess that Mp3tag is limited to something like 200 characters or less for the equivalent of MAX\_PATH (combined characters of directory path and file name). But I find it likely someone here has far more expertise than me and has more insight on Mp3tag's limit for this. Thanks!

It is always quite difficult to talk about speculation than on facts.  
You can find out the truth for yourself by doing a series of tests.  
Then inform the forum guests and the developer about the result.

In order to be informed about too long filenames I have opened a new column in Mp3tag list view near the filename column.  
The field "value" is filled with this expression ...

**$ifgreater($len(%\_filename\_ext%),64,'!'$len(%\_filename\_ext%),)**

... so it will be automatically obvious when a filename goes over the limit.  
I set the limit as the maximal CD filename length of 64 characters.  
You can do the same also for the overall length of the entire filepath.

Because the filename is the least important thing in the entire tagging process ("names are sound and smoke"), the 64 character limit is practical useful for me.  
The name carries track, title, artist, album, year in a sophisticated abbreviated manner. If I need more textual informations, then I look at the entire filepath structure, and if I need even more details, then I look into the tag fields.

The longest filepath in my collection has 254 characters.

Hmm, I did a short test ... renaming an existing mp3 file in the root of drive F.

Action: **Format value**  
Field: **\_FILENAME**  
Formatstring: **'F:'$repeat('A',251)**

... gives a filename with entire length of 258 characters.

One more character will lead Mp3tag to display an error message (and later on a somewhat corrupt list entry behind the scene).

You can reach the absolute MAX\_PATH size of 260 characters (259 readable characters plus one technical terminating null character) this way ...  
Action: **Format value**  
Field: **\_FILENAME**  
Formatstring: **'F:\Z'$repeat('A',250)**

For that example case there is no file path length limitation by Mp3tag.

This is the same behaviour like Windows XP Explorer application.

**258** characters maximal length for a filepathname in the root folder of a disk.

**259** characters maximal length for a filepathname in a subfolder of a disk.

 (I want to mention, that I am stumbled over a quirk or bug in Mp3tag which gives an erroneous error message and displays an erroneous content by the system variable %\_path%. Mp3tag needs to be restarted. When I am able to repeat this situation step by step I will come back and report.) 

DD.20100823.0816.CEST

 

Next round.

 

Having a filename: 1.mp3 (length=5)  
Action: **Format value**  
Field: **\_DIRECTORY**  
Formatstring: **'F:'$repeat('1234567890',24)'\1234'** (length=249)

 

Entire file path is (3 + 240 + 6) + 5 = 254 chars, is less than 260.  
Mp3tag does not complain and displays a status message "0 of 1 files ...", no change in filesystem.

 

Having a filename: 1.mp3 (length=5)  
Action: **Format value**  
Field: **\_DIRECTORY**  
Formatstring: **'F:'$repeat('1234567890',24)'\123'** (length=248)

 

Entire file path is (3 + 240 + 5) + 5 = 253 chars, is less than 260.  
Mp3tag displays a status message "0 of 1 files ..." and made the change in the filesystem!

 

Result: **248 chars is the maximum length for the path component** of the entire filepath.  
This sounds to be consistent with the MSDN article.  
_When using an API to create a directory, the specified path cannot be so long that you cannot append an 8.3 file name (that is, the directory name cannot exceed MAX\_PATH minus 12)._  
The equation is: 260 - 1 - 8 - 3 = 248.

 

DD.20100823.1818.CEST

 

Next round.

 

Having a filename: 12345678.mp3 (length=12)  
Action: **Format value**  
Field: **\_DIRECTORY**  
Formatstring: **'F:'$repeat('1234567890',24)'\123'** (length=248)

 

Entire file path is (3 + 240 + 5) + 12 = 260 chars, is equal to 260.  
Mp3tag displays an error message "12345678 cannot be moved ... too long ... cannot be accessed ..."

 

Result: **260 chars are not allowed**.  
This sounds not to be consistent with the MSDN article, which tell us about _free space for a 8.3 filename_.

 

Having a filename: 1234567.mp3 (length=11)  
Action: **Format value**  
Field: **\_DIRECTORY**  
Formatstring: **'F:'$repeat('1234567890',24)'\123'** (length=248)

 

Entire file path is (3 + 240 + 5) + 11 = 259 chars, is one less than 260.  
Mp3tag displays a status message "0 of 1 files ..." and made the change in the filesystem!

 

Result: **259 chars is the maximum length for the entire filepath**.  
This sounds not to be consistent with the MSDN article, because there is in fact _no_ free space for a 8.3 filename!

 

Anyway there seems to be a difference by one char.  
Is it a simple documentation error?  
Is it the terminating null char?  
Forgot one backslash path delimiter?

 

DD.20100823.1845.CEST

---

_[View the full topic](https://community.mp3tag.de/t/what-is-maximum-number-of-characters-allowed-in-filename/10690)._
