Text File to Tag Conversion Tips

This post is intended to summarize various other threads and my experience on the subject of creating MP3 tags from text files. Also, I want to offer some suggestions I have found useful. The online Help files at this time simply do not provide enough details to use this feature. I had to use earlier posts here and my own experimentation to determine how to make this feature work. This post may seem long and too detailed, but if you have several thousand "loose" files (no album organization) as I and another poster had, then these steps may save you some time.

MP3Tag offers several ways to import tags, the 'Text File --> Tag' feature being one of them. Obviously, this method is useful only if you have a data file or can obtain or prepare one relatively easily. If you have to build the data source from scratch, you may be better off entering the tags manually. Also, you benefit more if you have a lot of files to tag rather than a few. You have to compare the time it takes to prepare the list versus how long it would take to enter the tags manually or try to use auto tagging. (Auto tagging seems to work best if your files are organized by album.)

Another factor to consider is your current file names. If you have file names that include artist, album, track number, etc., you might be better off using the File Name --> Tag method. However, if you have files where the order of the data elements varies in the file names, the Text File method may be better because you won't have to continually change formats for each file name difference. In my case, I had only the song title in the file name, but I had built a spreadsheet over the years with 20,000+ songs. (Yes, I know. Get a life.) So, the Text File --> Tag method had great potential for me.

**Data Sources

You may have your data in a database such as Access, in a spreadsheet (Excel) as I do, in a word processing document or in a text file. Regardless of the source, the key is getting the final data into a format that matches the format string that must be defined in the program (see below for more on format strings). I prefer a spreadsheet because it works like a 'flat' database file. It is easy to sort. Data elements (columns) can be moved to change the order of the final output. Also, a spreadsheet makes it easy to add the same data values to many records at a time. I can sort my spreadsheet by artist, for example, and quickly add the same genre value to all the songs of that artist.

In a couple of threads there has been discussion of CSV (comma separated values) files. Typically, the data elements are separated by commas with quote marks around text strings especially if the text strings contain commas. Personally, I have found it better to save the data as tab-delimited. In the spreadsheet, I hit Ctrl-A to select all the data, then Ctrl-C to copy all the data. I then paste the data into a text editor. Alternatively, you can click on File\Save As and save the file as a tab-delimited text file.

**Why use a tab-delimited file rather than a CSV file?

  1. Eventually, the file will need to contain a character that acts as a delimiter or separator between each data element in each record. It can be just about any regular keyboard character - as long as it is not used in any data element. Examples are / ; ~ ` | *.
  2. Commas are not good delimiters because they are often found in titles.
  3. MP3Tag might assume the quote marks belong in the data elements, so they must not be in the text strings.
    The developer has stated that MP3Tag does not support processing of CSV files in their normal format with quotes marks. It can be used only a single data delimiter.

I use a text editor that has the ability to search for characters such as tabs or paragraph marks and replace or add to them other characters. If I have a text file record that looks like this:

c:[user]\Documents and Settings\My Music\filename.mp3 {tab} artist {tab} title {tab} year {tab} genre

I search for the tabs and replace them with a new delimiter or separator (/ or *) so that each record in my text file now looks like this:

c:[user]\Documents and Settings\My Music\filename.mp3/artist/title/year/genre
c:[user]\Documents and Settings\My Music\filename.mp3artisttitleyeargenre

One thing to watch out for in creating data sources and then moving them to a text file is spaces at the beginning or end of data elements. These can prevent matchups from occurring or can result in data being entered with the spaces embedded, making searches difficult later. In my case, I could use the text editor to replace {space}/ or /{space} with just /. That would remove any extra spaces.

Note that you would not actually see '{tab}' or '{space}.' The {tab} would be a blank area or some symbol such as >>, depending on the editor used and the display options selected. {space} is just the space bar hit once. The key is having a text editor that can search for such characters. Also, word processing programs such as Microsoft Word have the ability to search for and replace such characters. Trying to replace commas in a CSV file could be a problem if there are commas in titles. Also if there are commas in titles and you use commas as your delimiter, those records will fail.

**Building the Text File

Some of the details are discussed later, but here are some key points to remember as noted by the developer of MP3Tag:

  1. No empty lines in the text file. Also, no header or footer lines. Only data records with one row per record.
  2. Identical number of lines in the text file and selected tracks within Mp3tag.
  3. Each line in the text file must have an absolute filepath entry.
  4. Import tag mask must have a "%_path%" entry.
  5. The binding relation is the absolute filepath.

The MP3Tag program does not treat the text file like a database and search for matching records in the file. The program has to have data in the each record that matches a selected record in the files window. You can have multiple folders imported with all records in every folder selected. That is why the filepath entry is key. This is discussed in more detail below.

Item 2 is important as one user found out. In a post he said, "What otherwise would have been an enjoyable experience was a usability nightmare, as mp3tag presented me with a dialog box asking if I wanted to continue each time it encountered a line in the text file that didn't have a corresponding mp3. The choices were YES, NO, and CANCEL. As one import that I performed had 70 mp3s but approximately 850 lines in the text file, this was a painful process of holding down the 'Y' key (for yes) for perhaps 10 minutes to get mp3tag to continue through the import process each time it presented the dialog box."

The key is to build or edit a text data file that matches or covers the folder(s) you want to process. In my data source, I had folder names which enabled me to work with only that portion of my 20,000+ records that I needed to update the tags on. I was able to export the 2,000+ records I needed into another spreadsheet that I could then work with.

I have not seen anything so far that says the text file records have to be in the same order as the selected files in the program's files window, but I would try to organize the text file to match if possible. By default, MP3Tag sorts file names alphabetically within each folder displayed. Knowing this, the data source (spreadsheet for example) should be sorted in that same order before exporting the data to a text file. Even if this is not required, I would do it anyway just to make things easier.

**Format Strings

When you select one or more files in MP3Tag, the Convert menu items and the related conversion icons on the toolbar are enabled. The 'Text File --> Tag' is the one with the yellow arrow from a lined page to the red dot. If you click on that icon (or select Text file - Tag from the Convert menu option or hit Alt-4), you will get a dialog. You first enter or browse for the source text file name. Initially, the second field - Format string: - will be empty. By clicking on the right arrow button on the right, you can select the various elements - one at a time - that match your text file. Select them in the same order as the elements are in the text file. Using my example above, I would have:


Here is the key. Now click in the Format string field and manually add your delimiter to the string so that it looks like this:


You may see this referred to as an import tag mask or placeholder. The main thing to remember is that it tells the program how your data are arranged in each record and where the data goes in the various tags.

What if I have data in my source file I don't want added to the tags. Here is what the program developer says:

You may use the %dummy% placeholder as part of the format string to supress unwanted values. Having a line with many different values like:

Blue Sky Boys - Are You From Dixie;Various Artists;American Roadsongs - cd 5 - Are You From Dixie;20;1950;159;2.42 MB;25/01/2009;


This results into three tag fields TITLE, ARTIST, YEAR and nothing more.

**Path-Folder-File Names

In my earlier example, I had 'c:[user]\Documents and Settings\My Music\filename.mp3' as part of the data element. Why is this needed? What goes in the format string? According to the long thread on this subject in March 2009, the fully qualified path and file name is necessary for the program to process the records.

  1. The data element you need in the format string is not available from the dropdown list. You need to add it manually. Based on the long thread in March 2009, %_path% is the element needed. So that my final format string looked like this:


You can create different format strings if you have different data sources. The formats are saved, and the last one used displays the next time.

  1. Let's look at the path-folder portion first. Depending on whether you are using Windows XP or Vista, the path name may vary. Don't start with the My Documents (XP) or Users/Documents (Vista) folder. Go to the C: drive and drill down through the users to Documents and Settings to the actual folder with the files to be tagged. In my example, [user] would be replaced with an actual user name.

You can add the path-folder name quickly in a spreadsheet by inserting a blank column at the left of the data. Type or paste the full path name into the first row. Then use the spreadsheet's Copy feature to duplicate the path in each of the following rows. This assumes all the files are in that path. Remember that the path includes the folder containing the files. If they are in a folder under 'My Music,' that must be included.

  1. File names. If your original data source contained the files name, then a little editing trick can merge the path and file names. Arrange your data source (a spreadsheet is easier to do this) so that the path name column is to the immediate left of the filename column. When you export the spreadsheet to a text file as discussed above, you will have

c:[user]\Documents and Settings\My Music\ {tab} filename.mp3

Use your text editor's search and replace to replace '\My Music\ {tab}' with '\My Music'). The data element will then look like

c:[user]\Documents and Settings\My Music\filename.mp3

  1. What if you don't have the actual file names in your data source? There are a couple of things you can do. If the file names and the titles are the same, you can create a blank column in the spreadsheet and copy the titles column into the blank column. Then you add another column after the 'filename' column and put .mp3 in each row of that column. When you get the data to the text editor, use the same trick described earlier to merge the two columns together:

'filename {tab} .mp3' became 'filename.mp3'.

But what if my file names don't match the titles? Editing individual file names is out of the question.

I have a program called Directory Printer. There are several freeware or shareware programs like it. We need to process data in bulk. So, a few dollars for this program paid for itself in this one project in time and effort saved. I selected the folder containing the files I wanted to process. Using the program's options, I made sure I was getting files names with full directory/folder names. I was able to export the results to a tab delimited file which I got into another spreadsheet. Ultimately, I moved the data to my original data source spreadsheet. Because of common data elements, I has able to match the path\filename data with the matching records based on folder names and titles. It took some manual effort to fully integrate the path/file names with the base data, but it was a lot less time than it would take me to manually add tags to 2,000 files.

  1. What if I want to process files from a number of different folders at one time? Using the method just described in item 4 is the best and easiest way to build a file from multiple folders or from several levels of folders. As noted earlier, in the spreadsheet, you can sort by the path name and then by the file name to get the records in the data file to match what MP3Tag will display when you select the folders for processing.

**Data Cleanup

One advantage I found from this matching of my original data source with the path/file names was that some of my file names were mis-named when compared with my original data. I corrected the actual file names in their folders to match changes I made in the data file. Of course, I could have left the files names as is - as long as the actual file name matched the "file name" in the text file.

The file name is a concern if you build the file name from the titles or from some other source as I suggested earlier. I cannot say exactly what might happen when the program finds records in the text file or in the files list that it cannot match with the other. The program may just skip the record and move on. Once you know that the data are being correctly placed in the tag fields, then you can run the full file, or that part you did not use in testing.


If you have hundreds or thousands of records in your data file, it is a good idea to test the file and the program on a small sample of data first. Copy a section of data from the text file and save it to a new file. This ought to match a single folder or small group of folders. If you have all your files in one folder, you will need to select a portion of the records and then in the program's files window, select only those records that match the sample text file.

Use the preview button on the dialog to look at how the program plans on processing the data. Your default text editor will open showing data formatted like this example from the developer in another thread:

Having a line with three different values like:
Blue Sky Boys - Are You From Dixie;Various Artists;1950;

And a formatstring like:

It should result into three tag fields for one music file:
TITLE=Blue Sky Boys - Are You From Dixie
ARTIST=Various Artists

Look through the preview file, especially if you get a notice that not all the records were processed correctly. The file may help you locate records or file names that need to be corrected.

One user had Notepad as his default text editor, but when he ran several thousand records through and tried to use Preview, Notepad could not handle all the rows of data created. There are a number of freeware and shareware text editors that work much better than Notepad. For this reason, and for data search and replace method mentioned earlier, I would recommend a more robust text editor.

**Final Processing

If you are satisfied with the preview results, or you have stopped and edited your file to correct any problems, return to the Text File -> Tag dialog and click on OK. Depending on the number of records, it could take a while. The program will tell you how many records were processed.

Last Step: While the processed records are still selected, click on the Save icon or type Ctrl-S to save the updated tags.

Now, you will have dozens or hundreds of files with their tags set.

Well, BruceGil, first I have to say is, you did a clever verbose compilation of Mp3tag public but sometimes covered knowledge and wisdom!

For my part sometimes I would like to jump to the original sources you did refer to and read the original words from the authors, therefore you may insert into or append to your text work those links which points to the Mp3tag forum thread database on which your compilation relies on.

Even so you should be careful not to mix up "The developer has stated" statements with other user contributions. Yes, I have found some words and sentences of mine which are in your compilation now stated as words from the developer. Well, even I was pleased by this kind of professional elevation, I wonder, if the Mp3tag developer Florian Heidenreich would like those kind of interchanges with the simple Mp3tag user Detlev Dalitz (anyway, in these days I will get to write my 1.000th forum posting, he he, jubilee :-))).

Back to your "How to" compilation ...

I do not quite understand why you go the way of "outsourcing" to some spreadsheet application like MS Excel and do there much of the work you can do natively in Mp3tag.

Even so I do not understand why to use a third party directory print utility to get the track's filenames and pathes. Instead simply use Mp3tag report section and print right out the filepathes you see in the current Mp3tag tracklist. If needed then use such a created report textfile in your spreadsheet.

Yes, using TAB as a delimiter is a rather safe way to go. But why do you leave this way by replacing TAB with some other character like the slash character "/"? This character has ambigious meaning in the different filesystem areas where Mp3tag can be used. Using a string in your description like "%artist%/%title%/%year%/%genre%" let the reader think of or read this as a filesystem path, but this is not what you have intended. Better to go the TAB way consequently from Excel to Mp3tag without replacing the TAB with another character. Or use some other delimiter char like the star character. I think Excel supports a user defined delimiter character when exporting a "CSV/SSV/TAB/AnyChar" delimited export file.

... , and yes, I think so, that the adjustment resp. binding between the import textfile entries and the Mp3tag tracklist entries is based only on the %_path% content, so that the list on the "left side" can be at any order than the list on the "right side" as long as the amount of lines is the same and there will be used entries which do exist in the filesystem. The %_path% placeholder can be used at any place in the line.

Hmm, is there any default? I use the tracklist view sorted by "%_folderpath%%_filename_ext%", sometimes by "%album%%discnumber%%track%%title%", sometimes by "%_folderpath%%band%%album%%discnumber%%track%%title%" for example.

I use my import textfiles organized to any kind and believe on the %_path% placeholder that the binding job will be done fine by Mp3tag.



Thanks for the detailed summary.

I am trying to tag my mp3 files but I am facing some problems because some of the song titles have some European characters, e.g. tilde or the umlaut. Basically it's like this: for each album, I have a file with various fields separated by ";", one line per track. When I open the file in Notepad or other more sophisticated text editors, I can see the European characters just fine.

However, when I use the Text File --> Tag method and tries the preview, all of the European characters get screwed up. As I understand, Mp3Tag has had support for Unicode for a while (I am using v2.43)? In File->Options->Tag, I am writing to ID3v1 and ID3v2.3 UTF-16. Am I doing something wrong?

Any advice is greatly appreciated! Thanks.


This is a decent summary. Two additional areas where I'd like to have better information:

multiple tags: e.g., If I want to convert a second artist tag, how do I do so?
tags with segments: If I want to convert a tag like INVOLVEDPEOPLE or a TXXX tag, how do I do so?