how to convert GB to bytes and MB to bytes

Question

•

How to convert File size GB to bytes and MB to bytes using c#

thanks

Saturday, March 01, 2008 8:31 AM

• 1GB=1024MB
1MB=1024KB
1KB=1024bytes

so if you need to convert 2 GB to bytes you will get this: 2GB=2*1024*1024*1024 bytes.
Saturday, March 01, 2008 10:00 AM
• The first one is correct but others are incorrect.
As I have said 1Gb=1024MB so 4.7GB=4.7*1024MB On the other hand 1MB=1024KB so 4.7GB=4.7*1024*1024KB. multiply it by 1024 to get amount of bytes.
Sunday, March 02, 2008 10:23 AM

All replies

• 1GB=1024MB
1MB=1024KB
1KB=1024bytes

so if you need to convert 2 GB to bytes you will get this: 2GB=2*1024*1024*1024 bytes.
Saturday, March 01, 2008 10:00 AM
•

that mean

700 MB = 700 * 1024 * 1024 bytes

4.7 GB = 5 * 1024 *700 * 1024 * 1024 bytes

8.5 GB = 8 * 1024 * 500 * 1024 * 1024 bytes

is it correct ?

Saturday, March 01, 2008 10:09 PM
• The first one is correct but others are incorrect.
As I have said 1Gb=1024MB so 4.7GB=4.7*1024MB On the other hand 1MB=1024KB so 4.7GB=4.7*1024*1024KB. multiply it by 1024 to get amount of bytes.
Sunday, March 02, 2008 10:23 AM
• Warning! The previous post has a potentially confusing typo:

"As I have said 1Gb=1024MB so 4.7GB=4.7*1024MB ..."

The lowercase "b" is often used to indicate "bits", not "Bytes"!

(for example, in "Serial ATA 3.0Gb/s",  "3.0Gb/s" is meant to indicate gigabits-per-second...)

Conversion to bits would be a different conversion process.

Thursday, November 13, 2008 11:53 PM
• Here's a calculator that will convert among B KB MB GB and TB:

http://egret.net/kb__mb.htm
Sunday, July 12, 2009 6:03 PM
• Is this Decimal use or Binary use? i.e Decimal is done in 1000 and Binary is 1024. MB and MiB?
Friday, December 04, 2009 1:34 PM