# Bytes to Terabytes

Hi

We have a value 128000000000000 bytes and want to convert it to terabytes

To convert it to terabytes we do the following math

(((((128000000000000) / 8) / 1024) /1024 / 1024)

I saw this calculation somewhere and was wondering why are we dividing the value by 8?

Any help is appreciated

Thanks

That formula doesnâ€™t convert bytes to terabytes, it converts bits to gigabytes. The 8 is to go from bits to bytes.

Bytes to terabytes would be dividing by 1024 four times. The divisions take you from bytes to kilobytes to megabytes to gigabytes to terabytes.

128000000000000 bytes is 116.41 terabytes.
128000000000000 bits is 14.55 terabytes.

Why do we need to convert it into bits when the value is already in bytes?

You donâ€™t, which is why I said â€śthat formula doesnâ€™t convert bytes to terabytesâ€ť.

What should be the formula to convert from bytes to terabytes then?

^ That

Except if you are talking computer hardware in which case divide by 1000 four times instead.

So the formula would be?

((((128000000000000) / 1024) /1024 / 1024) /1024

Yes, divide by 1024 four times.

You can check your code by doing a Google search. Just type â€ś[number] bytes to terabytesâ€ť and it will compute the answer and give it to you