Data Storage Conversion: Bytes, Megabytes, Gigabytes, and Terabytes

Complete guide to data storage unit conversions. Learn how to convert between bytes, MB, GB, TB, and other digital storage measurements.

Data Storage Conversion: Bytes, Megabytes, Gigabytes, and Terabytes Introduction Understanding data storage units and how to convert between them is essential for engineers, scientists, IT professionals, and everyday users. Storage capacity, file size, memory, and data transfer figures are all expressed using units such as bytes, kilobytes, megabytes, gigabytes, and terabytes. However, there are two common bases for these units — decimal (powers of 10) and binary (powers of 2) — and confusion between them often causes unexpected results (for example, why a "500 GB" hard drive appears smaller in your operating system). This article explains the key concepts and definitions, provides clear conversion formulas and worked examples, presents a quick reference table, and discusses real-world applications and best practices to avoid mistakes. Key Concepts / Definitions Bit (b): The smallest unit of digital information representing 0 or 1. Byte (B): A group of 8 bits. This is the common base unit for storage and file sizes. 1 byte = 8 bits Decimal (SI) prefixes (used by many storage manufacturers): 1 kilobyte (kB) = 1,000 bytes 1 megabyte (MB) = 1,000,000 bytes (10^6) 1 gigabyte (GB) = 1,000,000,000 bytes (10^9) 1 terabyte (TB) = 1,000,000,000,000 bytes (10^12) Binary (IEC) prefixes (commonly used by operating systems and memory specifications): 1 kibibyte (KiB) = 1,024 bytes (2^10) 1 mebibyte (MiB) = 1,048,576 bytes (2^20) 1 gibibyte (GiB) = 1,073,741,824 bytes (2^30) 1 tebibyte (TiB) = 1,099,511,627,776 bytes (2^40) Important: Many consumer-facing labels (hard drives, SSDs) use decimal prefixes, while many operating systems and RAM specs use binary prefixes. Always check which convention is being applied. Conversion Formulas Below are the most useful formulas for converting between units. Bolded formulas indicate the standard relationships. Between bits and bytes: 1 byte = 8 bits bits = bytes × 8 bytes = bits ÷ 8 Decimal conversions (SI): kilobytes (kB) = bytes ÷ 1,000 megabytes (MB) = bytes ÷ 1,000,000 (10^6) gigabytes (GB) = bytes ÷ 1,000,000,000 (10^9) terabytes (TB) = bytes ÷ 1,000,000,000,000 (10^12) Binary conversions (IEC): kibibytes (KiB) = bytes ÷ 1,024 (2^10) mebibytes (MiB) = bytes ÷ 1,048,576 (2^20) gibibytes (GiB) = bytes ÷ 1,073,741,824 (2^30) tebibytes (TiB) = bytes ÷ 1,099,511,627,776 (2^40) Converting between decimal and binary-labeled units: To convert from decimal GB to GiB: GiB = (GB × 10^9) ÷ 2^30 To convert from GiB to GB: GB = (GiB × 2^30) ÷ 10^9 Best practice: when precision matters, compute using bytes (integer values) and only convert to larger units for display. Conversion Reference Table | Unit (decimal) | Equal to (bytes) | Unit (binary) | Equal to (bytes) | |---:|---:|---|---:| | 1 B | 1 B | 1 B | 1 B | | 1 kB | 1,000 B | 1 KiB | 1,024 B | | 1 MB | 1,000,000 B | 1 MiB | 1,048,576 B | | 1 GB | 1,000,000,000 B | 1 GiB | 1,073,741,824 B | | 1 TB | 1,000,000,000,000 B | 1 TiB | 1,099,511,627,776 B | Use this table as a quick lookup when converting or validating storage figures. Practical Examples (with worked calculations) Below are several concrete, step-by-step examples illustrating conversion between units, handling bits vs bytes, and interpreting manufacturer labels. Example 1 — Converting bytes to MB and MiB Problem: Convert 5,242,880 bytes to MB (decimal) and MiB (binary). Step 1 (decimal MB): Use MB = bytes ÷ 1,000,000. MB = 5,242,880 ÷ 1,000,000 = 5.24288 MB Step 2 (binary MiB): Use MiB = bytes ÷ 1,048,576. MiB = 5,242,880 ÷ 1,048,576 = 5 MiB Interpretation: 5,242,880 bytes is exactly 5 MiB (because 5 × 1,048,576 = 5,242,880) but shows as ~5.24288 MB in decimal terms. Example 2 — Why a 500 GB drive shows ~465.66 GB in your OS Problem: A drive is labeled 500 GB by the manufacturer. What does the operating system (reporting GiB) show? Manufacturers use decimal: 500 GB = 500 × 1,000,000,000 bytes = 500,000,000,000 bytes. OS often reports in GiB (binary): GiB = bytes ÷ 2^30 GiB = 500,000,000,000 ÷ 1,073,741,824 ≈ 465.66 GiB Conclusion: A 500 GB marketed drive appears as ~465.66 GiB in an OS that uses binary units. Example 3 — How many 3.5 MB photos fit on a 64 GB phone? Problem: Count photos if each photo is 3.5 MB and phone capacity is 64 GB (manufacturer decimal). Step 1: Convert both to bytes (assume MB and GB use decimal prefixes here). Photo size = 3.5 MB = 3.5 × 1,000,000 = 3,500,000 bytes Phone capacity = 64 GB = 64 × 1,000,000,000 = 64,000,000,000 bytes Step 2: Divide capacity by photo size: Count = 64,000,000,000 ÷ 3,500,000 ≈ 18,285.71 photos Final: Approximately 18,285 photos (practical capacity will be lower due to OS, apps, and formatting overhead). Note (binary-aware): If you instead compare to the OS-reported available GiB, do conversions with GiB and MiB or work always in bytes to avoid confusion. Example 4 — Streaming bitrate to storage (bits vs bytes) Problem: A camera records at 5 Mbps (megabits per second). How much storage does 1 hour consume in GB? Step 1: Conve