Bits and Bytes
Last Updated: 2021-12-07
Bit vs Byte
- bit: a single
0
or1
. 2 different values. The most basic unit of computing - byte: 1 byte = 8 bits = 2 hex = 256 different values. A.k.a "octet". Still "naked"
0
s and1
s, can be interpreted in different ways. - characters:
- historically, 1 byte (8 bits) is used to encode a single character: ASCII uses 7 bits, 128 code points, more than enough for English characters (both lowercase and uppercase). One extra bit can be used as a parity bit.
- now one character may need more than one byte to store, depend on the encoding.
Multiple-byte Units
Unit | Abbrev. | Bytes | Unit | Abbrev. | Bytes |
---|---|---|---|---|---|
kB | kilobyte | 1000 | KiB | kibibyte | 1024 |
MB | megabyte | 10002 | MiB | mebibyte | 10242 |
GB | gigabyte | 10003 | GiB | gibibyte | 10243 |
TB | terabyte | 10004 | TiB | tebibyte | 10244 |
PB | petabyte | 10005 | PiB | pebibyte | 10245 |
EB | exabyte | 10006 | EiB | exbibyte | 10246 |
ZB | zettabyte | 10007 | ZiB | zebibyte | 10247 |
YB | yottabyte | 10008 | YiB | yobibyte | 10248 |
Note if there's an i
in the unit name: with an i
, it is binary, otherwise decimal.
For example:
- terabyte (TB): 1012, or 10004, or 1,000,000,000,000 bytes
- tebibyte (TiB): 240, or 10244, or 1,099,511,627,776 bytes, roughly 1TiB = 1.1TB
Real world examples
- 3.5 inch Floppy Disk: 1,440 KiB = 1.47 MB = 1.41 MiB
- CD: up to 700 MB
- DVD: 4.7 GB = 4.38 GiB for a single-layered, single-sided disc
- Blu-ray: 25 GB for single-layer
- The Complete Works of William Shakespeare would occupy about 5,600,000 bytes when written in plain text without formatting.