17 June 2005
Calculating Download Times
Posted by Mikhail Esteves under: Miscellaneous; Projects; Tips .
Let’s say you have this file that you allow your visitors to download, and you want to show them a helpful estimation of download time. How do you do this?
- Find out which connection they’re using — 56.6 kbps, T1 (1.544 mbps), Cable, DSL, etc. Cable/DSL are also available at fractional speeds like 256kbps, 386kbps, 512kbps, or 768kbps so you need to decide which ones you want to present your user.
- We need to convert both the file size and the connection speed to a common measuring unit, which can be bytes or bits. I’ll use bits for this example (connection speeds are already in bits. So 56.6kbps = (56.6 * 1024) = 57,958.4 bits).
- Do the same thing with the file size — say your file is 50KB… Multiply it by 1024 to get the file size in bytes. So 50 KB * 1024 = 51,200 bytes. Multiply that by 8 to get it in bits: 51,200*8 = 4,09,600 bits
- Now divide the file size by the connection speed — 4,09,600/57,958.4 = 7.06 seconds
Download Time Calculator is a script that will give you download times for various connection types based on the file size you provide.