bytes, kilobytes, megabytes

Units of data size: a kilobyte is about a thousand bytes, a megabyte about a million, a gigabyte about a billion.

In more detail

A byte is eight bits, enough to hold one small number from 0 to 255 or one plain-English character. Memory limits and file sizes are written in these units. Some tools count in powers of 1,024 (KiB, MiB, GiB) rather than 1,000, so figures can differ by a few percent.

Examples

Counting sort over 32-bit keys would need a count array of about four billion entries.
Kafka sizes such as batch.size, segment.bytes and retention.bytes are in bytes.
A build turns source into a set of bytes; promotion moves those same bytes forward rather than rebuilding different ones.
In the browser: Docker flags use binary units: -m 64m means 64 mebibytes, 64 times 1024 times 1024 bytes, which is why memory.max then reads 67108864. Tools write KiB, MiB and GiB for the binary versions and KB, MB and GB for powers of 1000, though many use them loosely.
A 1200-megabyte builder image shrinks to a 95-megabyte runner image.
git cat-file -s HEAD prints the size of a commit in bytes.
fmt.Printf("read %d bytes\n", len(back))
A byte is eight bits, enough for one character of plain text. Tools such as df -h and du -h print sizes with suffixes like K, M and G; these usually mean powers of 1024 (kibibytes, mebibytes, gibibytes), which are slightly larger than the decimal units.
log=8G cache=2G reports directory sizes of about 8 and 2 gibibytes.
Standalone output can shrink a Next.js image from over a gigabyte to around 150 megabytes.
Record sizes in bytes and let dashboards convert to megabytes.
A generator over a file uses a few kilobytes however large the file is.
An MFT record is usually 1 KiB (1,024 bytes); the imaging script reads 64 KiB blocks.
kilo, mega, giga, tera: each step is 1,000.

Related terms

Taught in

References

Certification courses