Here is the list with numbers of bytes for each size. With this, you can quickly identify which size metric to show instead of saying a number of bytes. Very helpful for your next System Design Interview.
1 Byte = 8 bit. For simplicity, I am using 1000 as the base instead of 1024 for KB and further calculations. You can mention this to the interviewer to make them aware.
| Size | Abbr. | Number of Bytes (words) | Number of Zeroes | Number of Bytes |
|---|---|---|---|---|
| KiloBytes | KB | Thousands – K | 3 | 1,000 |
| MegaBytes | MB | Millions – M | 6 | 1,000,000 |
| GigaBytes | GB | Billions – B | 9 | 1,000,000,000 |
| TeraBytes | TB | Trillions – T | 12 | 1,000,000,000,000 |
| PetaBytes | PB | Quadrillion – Q | 15 | 1,000,000,000,000,000 |
| ExaByte | EB | Quintillion – 🤷♂️ | 18 | 1,000,000,000,000,000,000 |
| ZettaByte | ZB | Sextillion – 🤷♂️ | 21 | 1,000,000,000,000,000,000,000 |
| YottaByte | YB | Septillion – 🤷♂️ | 24 | 1,000,000,000,000,000,000,000,000 |
Bytes Calculations (best view on Desktop)
How to Use This to Calculate Size in System Design Interview
Example with Database Record
Let’s say I am in a system design interview. I want to store N numbers of records. N can be any number from thousands to Quadrillion. Each record is approximately 1000 Bytes.
Here is how I can solve this for various values of N.
Always remember that in System Design Interview assumption is in your hand (most of the time), so choose a number that would be easier to calculate. like 100 Million, 50 Million, 1 Billion etc. Don’t choose any arbitrary number like 333 million, or 43.8 thousand.
N = 100 Million. Records are 1000 Bytes each. I will do, 100 Million (from records) * 1000 (record size) = 100 * 1 Million * 1 Thousand. The multiplication result would be the addition of zeroes 😉. That would be 2 zeroes + 6 zeroes + 3 zeroes (from 100, 1M, and 1K respectively) = 11 zeroes = 100 Billion. From the list, it would become 100 GB.
For N = 40 Million. Number of zeroes would be 40 * 1 M * 1 K = 1 Zero + 6 Zeroes + 3 Zeroes = 10 Zeroes = 10 Billion. Taking 4 of 40 would be 4 * 10 Billion = 40 Billion = 40 GB.
Example with File
Another example is where I have M number of audio files with an average size of 7MB. Again, M can be any number, 80 Million, 1 Billion, etc.
M = 70 Million. 7 MB * 70 Million. 6 Zeroes from 7 MB and 7 Zeroes from 70 MB. It would become 6 + 7 = 13 Zeroes = 10 Trillion = 10TB. And both are 7 so 7 * 7 = 49 so it would be 10 * 49 = 490 TB. or 0.49 PT, rounding off to 0.5 PT
You can quickly go through the list before your system design interview for reference.
On a totally unrelated note 🤓, read my post on A Quick Glance at Sorting Algorithms Code in Java with Code on GitHub.
