# Different Image Size

## Recommended Posts

Hi all,

I have uploaded an image to a folder/directory and stored its size using the \$_FILES['image']['size'] superglobal. While the image source size was reading 153kb, the stored size is 157317. Why there is a difference in size?

##### Share on other sites

A kilobyte is 2^10 bytes.

2^10 * 153 = 156672.

If you account for the fact that the number is rounded down the file should be the exact same size.

We can do it the other way around, divide bytes by 2^10 and truncate the result:

157317 / 2^10 = 153.629882813

Truncating (removing the decimal part) results in 153.

A megabyte is 2^20 bytes and gigabyte is 2^30 bytes.

##### Share on other sites

Note that hardware manufacturers like to use the definition that 1KB = 1000 bytes, instead of 1024 (2^10). That's why you can buy a hard drive which says it is 1TB, but when you install it then Windows claims it is 909GB. That's because to a hardware manufacturer, 1TB = 1 trillion bytes, but to software programmers 1TB = 2^40 = 1099511627776 bytes.

## Create an account

Register a new account