# Calculate MP3 Length

**URL:** https://community.mp3tag.de/t/calculate-mp3-length/10145
**Category:** Support
**Created:** [March 20, 2010, 9:51am UTC](https://community.mp3tag.de/t/calculate-mp3-length/10145 "2010-03-20T09:51:51Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![adrianh](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/a/b77776/32.png) [@adrianh](https://community.mp3tag.de/u/adrianh)
#### Post date: [March 20, 2010, 9:51am UTC](https://community.mp3tag.de/t/calculate-mp3-length/10145/1 "2010-03-20T09:51:51Z")

</div>

Hi

Is it possible for MP3Tag to calculate the length of selected mp3's and update the LENGTH field in the tag via an action (or a batch mode)

Reason for this question is that the XBox 360 only displays the duration of a mp3 when the LENGTH tag is present.

Regards

---

<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: [March 20, 2010, 10:13am UTC](https://community.mp3tag.de/t/calculate-mp3-length/10145/2 "2010-03-20T10:13:49Z")

</div>

> [@adrianh](#):
>
> ...Is it possible for MP3Tag to calculate the length of selected mp3's and update the LENGTH field in the tag via an action (or a batch mode)

Yes, it is possible.  
If you speak about duration in seconds, then you can use the **%\_length\_seconds%** system variable, which contains the length of the music part of a file in seconds.  
This length is a value rounded to seconds, not an accurate value of samples or fractions of a second.  
Create an action "Format value" for the tag field LENGTH and use %\_length\_seconds% as format string.  
Run this action against each file you want.

DD.20100320.1213.CET

---

<div class="post-metadata">

### Author: ![adrianh](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/a/b77776/32.png) [@adrianh](https://community.mp3tag.de/u/adrianh)
#### Post date: [March 20, 2010, 10:29am UTC](https://community.mp3tag.de/t/calculate-mp3-length/10145/3 "2010-03-20T10:29:09Z")

</div>

Thanks for the prompt reply, this solution works great. 🕶

Note that LENGTH fields holds milliseconds so I had to multiply **%\_length\_seconds%** by 1000.

_$mul(%\_length\_seconds%,1000)_

---

<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: [March 20, 2010, 10:35am UTC](https://community.mp3tag.de/t/calculate-mp3-length/10145/4 "2010-03-20T10:35:46Z")

</div>

> [@adrianh](#):
>
> Thanks for the prompt reply, this solution works great. 🕶 Note that LENGTH fields holds milliseconds so I had to multiply **%\_length\_seconds%** by 1000.  
> _$mul(%\_length\_seconds%,1000)_

Ok, well done.

See also ...  
[Tag LENGTH](https://community.mp3tag.de/t/9051/4)

DD.20100320.1235.CET

---

<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: [February 2, 2023, 2:57pm UTC](https://community.mp3tag.de/t/calculate-mp3-length/10145/5 "2023-02-02T14:57:06Z")

</div>

2 posts were split to a new topic: [Display LENGTH in column](https://community.mp3tag.de/t/display-length-in-column/59930)

---

<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: [February 2, 2023, 3:28pm UTC](https://community.mp3tag.de/t/calculate-mp3-length/10145/6 "2023-02-02T15:28:05Z")

</div>

A post was merged into an existing topic: [Display LENGTH in column](https://community.mp3tag.de/t/display-length-in-column/59930/4)

---

<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: [February 2, 2023, 3:31pm UTC](https://community.mp3tag.de/t/calculate-mp3-length/10145/7 "2023-02-02T15:31:24Z")

</div>


