# Add zero in front of track number

**URL:** https://community.mp3tag.de/t/add-zero-in-front-of-track-number/10896
**Category:** Support
**Created:** [October 3, 2010, 2:43am UTC](https://community.mp3tag.de/t/add-zero-in-front-of-track-number/10896 "2010-10-03T02:43:37Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![Eoghanalbar](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/e/d78d45/32.png) [@Eoghanalbar](https://community.mp3tag.de/u/Eoghanalbar)
#### Post date: [October 3, 2010, 2:43am UTC](https://community.mp3tag.de/t/add-zero-in-front-of-track-number/10896/1 "2010-10-03T02:43:37Z")

</div>

I tried using replace with regular expressions '.' to '0.' and '%track%' to '0%track%'but neither worked. Can anyone else figure this out?

Thanks a lot!

~Owen

---

<div class="post-metadata">

### Author: ![dr-412](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/db5fbb/32.png) [@dr-412](https://community.mp3tag.de/u/dr-412)
#### Post date: [October 3, 2010, 3:22am UTC](https://community.mp3tag.de/t/add-zero-in-front-of-track-number/10896/2 "2010-10-03T03:22:31Z")

</div>

Try $num(%track%,2) in a format value.

Have a nice day 🙂

---

<div class="post-metadata">

### Author: ![Eoghanalbar](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/e/d78d45/32.png) [@Eoghanalbar](https://community.mp3tag.de/u/Eoghanalbar)
#### Post date: [October 3, 2010, 3:32am UTC](https://community.mp3tag.de/t/add-zero-in-front-of-track-number/10896/3 "2010-10-03T03:32:40Z")

</div>

> [@dr-412](#):
>
> Try $num(%track%,2) in a format value.
> 
> Have a nice day 🙂

Wow! That was amazingly helpful! And ridiculously fast, too! You, my friend, ROCK. =D

Hey, do you know where I could look to learn the structure behind that? I mean, WHY it works, so I could recreate it myself from my own understanding, you know?

Again, thanks a lot! =]

~Owen

---

<div class="post-metadata">

### Author: ![dr-412](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/db5fbb/32.png) [@dr-412](https://community.mp3tag.de/u/dr-412)
#### Post date: [October 3, 2010, 3:54am UTC](https://community.mp3tag.de/t/add-zero-in-front-of-track-number/10896/4 "2010-10-03T03:54:02Z")

</div>

> [@Eoghan](#):
>
> Wow! That was amazingly helpful! And ridiculously fast, too! You, my friend, ROCK. =D
> 
> Hey, do you know where I could look to learn the structure behind that? I mean, WHY it works, so I could recreate it myself from my own understanding, you know?
> 
> Again, thanks a lot! =]
> 
> ~Owen

No problemo

I found it a few days ago in a very helpful page : Scripting functions  
(Help/contents/More features -\> Scripting functions)

You will find the description of this function in "Pad decimal number with leading zeros" section.

As you see, I am a newbee in this forum and use Mp3tag since a week only.  
But since I found this page, everything is simplier !

Hope that you'll found it useful too.

---

<div class="post-metadata">

### Author: ![LuNatic](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/73ab20/32.png) [@LuNatic](https://community.mp3tag.de/u/LuNatic)
#### Post date: [November 17, 2010, 7:10am UTC](https://community.mp3tag.de/t/add-zero-in-front-of-track-number/10896/5 "2010-11-17T07:10:48Z")

</div>

I'm looking to add Leading 0's to my tracks as well, but the help guide doesn't explain where and I how I enter this function, and neither did 5 mins of googling. Can anyone give me a quick scripting 101 so I can do this? Thanks.

---

<div class="post-metadata">

### Author: ![Eoghanalbar](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/e/d78d45/32.png) [@Eoghanalbar](https://community.mp3tag.de/u/Eoghanalbar)
#### Post date: [November 17, 2010, 7:51am UTC](https://community.mp3tag.de/t/add-zero-in-front-of-track-number/10896/6 "2010-11-17T07:51:57Z")

</div>

Ooh, I can answer this one!

ctrl-a in the list of files in the main window, right click, convert, actions, standard (double click on it), new (top right hand side button with the icon of a yellow star on a white page), "Format value" from the drop down (OK), single click on that entry (now in the list) to highlight it, press OK in the bottom of the actions window, press OK again in the actions groups window, aaaannd you're done.

Wow, I hadn't realized how ridiculously complicated that was before describing it. How the hell did I figure that out the first time?

Anyway yeah, this will only add a leading zero to single digit track numbers, so you don't have to worry about making '9' into '09' but also making '10' into '010', for instance. You can just ctrl-a the whole list of files. Not sure about triple digit track numbers, but I wouldn't think you'd have to deal with those, amiright?

Yay, I'm helpful! =]

~Owen

---

<div class="post-metadata">

### Author: ![LuNatic](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/73ab20/32.png) [@LuNatic](https://community.mp3tag.de/u/LuNatic)
#### Post date: [November 17, 2010, 8:27am UTC](https://community.mp3tag.de/t/add-zero-in-front-of-track-number/10896/7 "2010-11-17T08:27:38Z")

</div>

That's done it. Many thanks!

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [November 19, 2010, 5:39pm UTC](https://community.mp3tag.de/t/add-zero-in-front-of-track-number/10896/8 "2010-11-19T17:39:46Z")

</div>

OK, if you are done.  
Just a note: if you want to keep the numbering in your collection unified then you should set the numbering to 3 digits. There are some audiobooks or podcast-collections that have more than 100 tracks for one album. So by setting it to 3 digits always you do not have to worry about 09s and 010s.  
You can easily modify the existing numbering with an action that reformats the tag field:

Action of the type "Format tag field"  
Format tag Track  
Format string: $num(%track%,3)

---

<div class="post-metadata">

### Author: ![Tripitaka](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/51bf81/32.png) [@Tripitaka](https://community.mp3tag.de/u/Tripitaka)
#### Post date: [December 1, 2010, 10:06am UTC](https://community.mp3tag.de/t/add-zero-in-front-of-track-number/10896/9 "2010-12-01T10:06:23Z")

</div>

Hmmm...any idea why both the Track number wizard AND scripting with $num(%track%,3) fails to put leading zeros in front of my tracks?

Everything else works OK, I can add and delete track numbers so it isn't a permissions or read-only issue. No error messages, executes fine but just doesn't add the zeros. Strange AND frustrating!

Mark.

---

<div class="post-metadata">

### Author: ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)
#### Post date: [December 1, 2010, 11:41am UTC](https://community.mp3tag.de/t/add-zero-in-front-of-track-number/10896/10 "2010-12-01T11:41:16Z")

</div>

What audio format are you using? m4a/mp4 don't support leading zeroes.

---

<div class="post-metadata">

### Author: ![Tripitaka](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/51bf81/32.png) [@Tripitaka](https://community.mp3tag.de/u/Tripitaka)
#### Post date: [December 1, 2010, 12:09pm UTC](https://community.mp3tag.de/t/add-zero-in-front-of-track-number/10896/11 "2010-12-01T12:09:55Z")

</div>

Badda-bing! I did not know that and yes, that is exactly what I am using. Every day is a school day.

In that case, if I create a text file to import, _exactly_ what is the format to put in it to rename the title field. I've read the help files on it but it still isn't clear; I'm much better learning from an example. If I was to guess, I would choose "text file - tag", choose %title% in the Format string: box and point it to a file that had one line entry per file in the format of "filename - 001".

Does that look right?

---

<div class="post-metadata">

### Author: ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)
#### Post date: [December 1, 2010, 2:55pm UTC](https://community.mp3tag.de/t/add-zero-in-front-of-track-number/10896/12 "2010-12-01T14:55:37Z")

</div>

> [@](#):
>
> Does that look right?

It will put "filename - 001" in the title. I don't know what exactly you want.

---

<div class="post-metadata">

### Author: ![sept2010](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/edb3f5/32.png) [@sept2010](https://community.mp3tag.de/u/sept2010)
#### Post date: [January 11, 2011, 5:03pm UTC](https://community.mp3tag.de/t/add-zero-in-front-of-track-number/10896/13 "2011-01-11T17:03:27Z")

</div>

Hi guys,

What if you have a 2 DISC album with the total of 20 tracks. Track 1 - 10 set to DISC 1 and 11 - 20 on DISC 2. I get this wrong since the DISC numbering is from 1 - 20

```
[size="2"]%discnumber%$num(%track%,2)-%artist%-%title%[/size]

```

Result:  
**101-artist-title.mp3  
102-artist-title.mp3  
103-artist-title.mp3  
104-artist-title.mp3  
105-artist-title.mp3  
106-artist-title.mp3  
107-artist-title.mp3  
108-artist-title.mp3  
109-artist-title.mp3  
110-artist-title.mp3  
211-artist-title.mp3  
212-artist-title.mp3  
213-artist-title.mp3  
214-artist-title.mp3  
215-artist-title.mp3  
216-artist-title.mp3  
217-artist-title.mp3  
218-artist-title.mp3  
219-artist-title.mp3  
220-artist-title.mp3**

Is there any way to accoplish the result below without doing this a manual procedure ? Instead of DISC 2 starts with **211** is starts with **201**

Result:  
**101-artist-title.mp3  
102-artist-title.mp3  
103-artist-title.mp3  
104-artist-title.mp3  
105-artist-title.mp3  
106-artist-title.mp3  
107-artist-title.mp3  
108-artist-title.mp3  
109-artist-title.mp3  
110-artist-title.mp3  
201-artist-title.mp3  
202-artist-title.mp3  
203-artist-title.mp3  
204-artist-title.mp3  
205-artist-title.mp3  
206-artist-title.mp3  
207-artist-title.mp3  
208-artist-title.mp3  
209-artist-title.mp3  
210-artist-title.mp3**

// Regards

---

<div class="post-metadata">

### Author: ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)
#### Post date: [February 9, 2026, 12:22pm UTC](https://community.mp3tag.de/t/add-zero-in-front-of-track-number/10896/14 "2026-02-09T12:22:35Z")

</div>


