**When calculating data transfer rates we have to understand a few things. Firstly for this example we are ignoring network latency and additional packet data that gets sent along with the file. Next we need to understand the units of measurement and it’s here that some people have trouble and a lot of sites out there publish incorrect methods.**

Namely the ‘answers’ sites where people ask this very question and either get responses incorrect working/ logic or told to find an online calculator neither of which are of any help to anyone. There is probably a really nice and simple equation for doing this without the below calculations but I will write my method down here. To begin with let us take our example file of say a 2 Gb file size and a transfer speed of 50 Mbps

**Bytes in a Kilobyte, Megabyte, Gigabyte**

Computer file sizes are measured in bytes, a byte is made up of 8 bits, a bit being a representation of a binary value or state (a 1 or 0, true or false, yes or no etc…) A Kilobyte (KB) is made of 1,024 bytes, a Megabyte (MB) contains 1,024 Kilobytes, a Gigabyte (GB) has 1,024 megabytes and so on – bytes are grouped in groups of 1,024. This is very important to understand, so in our case a 2 Gb file is not just 2 x 1,000 x 1,000 x 1,000 bytes (2,000,000,000), but in fact 2 x 1,024 x 1,024 x 1,024 bytes (2,147,483,648).

**Always work in bits**

So we understand file sizes and their measurements, next we must look at the transfer speeds and their measurements which are very different. Transfer speeds are measured in bits per second – not bytes per second! So 50 Mbps or “50 meg a second” is not 50 Megabytes per second, but rather 50 Megabits per second. So in order to calculate the transfer rate of a file size we need to convert the size to bits, however, you can’t just say that 2 Gb x 8 will give you the number of bits in the file. Remember that 1 byte is 8 bits, so we need to convert the file size all the way down to exactly how many bytes it is in order to then multiple it by the number of bits. So a 2 Gb file is 2 x 1,024 x 1,024 x 1,024 x 8 bits (17,179,869,184).

**Bits in a Kilobit, Megabit, Gigabit**

Now we know how many bits we are transferring we can then divide by our speed to get the time. But the final gotcha here is that our file size is in bits, we need to convert our transfer speed of 50 Mbps to bps (bits per second) in order to work out the transfer time. So how many bits are there in a Megabit? Well unlike bytes the grouping of bits is in 1,000’s so there are 1,000 bits to a Kilobit (Kb), 1,000 Kilobits to a Megabit (Mb) etc… So we convert our 50 Mbps to 50 x 1,000 = 50,000 Kbps x 1,000 = 50,000,000 bps.

**The answer**

This is our transfer time for a 2 Gb file which is 17,179,869,184 bits / 50,000,000 bits per second = 343.59738368 seconds. As a formula this could be expressed as:

file size (b) / transfer speed (bps) = time (s).

Always remember to convert your file size and your transfer speeds to bits! Always remember that file sizes are in bytes grouped by multiples of 1,024 while speeds are in bits grouped in multiples of 1,000. And that this calculation does not take into account throughput, latency, extra data packets etc…

You may also have noted the use of (MB) and (Mb), an uppercase B should always be a unit of bytes where as the lower case b should always refer to a unit of bits.

Of course I could have just pointed you to an online calculator instead.

## 5 Comments

hey man thanks for this, i was having a killer time with my homework until i came across this formula. thanks!

Great explanation – thanks very much! There seems to be a lot of rubbish about on the Internet, but this really gets it on the nose!

how calculate loading computing and network, if load 100kb a file

how to calculate the completion time of a virtual machine, if klainnya downloading a file size of 100 kb with a regular starting time of 20 ms, 500ms to 100ms to 1000ms, is there a formula to calculate the long download time and calculate bandwithnya, if there is please help, another loss for the formula ok

Good solution

i am trying to search since 2 days

Thanks