Convert between binary data-size units using the IEC 1024-based scale common in operating systems, RAM specs, and storage dashboards—bytes, kibibytes (KB), mebibytes (MB), gibibytes (GB), and tebibytes (TB).
Formula
Each unit maps to a factor in bytes:
| Unit | Bytes |
|---|---|
| byte | 1 |
| kilobyte | 1,024 |
| megabyte | 1,024² |
| gigabyte | 1,024³ |
| terabyte | 1,024⁴ |
To convert X from unit A to unit B:
output = X × factor(A) ÷ factor(B)
Results are rounded to eight decimal places for display stability.
When to use it
Translating installer sizes between MB and GB, reconciling df -h output with byte counts, teaching binary prefixes versus decimal SI (1 KB = 1000 B in marketing labels), or verifying backup capacity math.
Limitations
Uses 1024-based factors only—not decimal kilo (1000) labels found on some USB drive packaging. Does not handle bits per second, block sizes, or filesystem overhead. Extremely large values may show floating-point noise in the last decimal. Temperature and other unit groups are out of scope for this converter.
Example
1 megabyte → 1,024 kilobytes. 2 gigabytes → 2,048 megabytes.