What this note is really about

When people first see terms like:

  • KB
  • MB
  • GB
  • KiB
  • MiB
  • binary
  • decimal

they often feel like the topic is just a naming mess.

But the real topic is deeper than that.

This is really about:

  • how computers represent information
  • why powers of 2 appear everywhere
  • why storage and memory are often described differently
  • why 1 MB is sometimes not the same as 1 MiB
  • how these ideas connect to RAM, disks, files, and CPU architecture

If you understand the underlying logic, the terminology stops feeling arbitrary.


The big picture first

Computers fundamentally work with discrete states.

At the lowest practical level, electronic hardware is built from components that can reliably distinguish between two conditions such as:

  • low voltage / high voltage
  • off / on
  • false / true
  • 0 / 1

That is why binary is so central.

It is not because humans like base 2.

It is because physical hardware can reliably implement two-state logic far more easily than ten-state logic.

So if you want the broadest single idea, it is this:

binary is the natural language of digital hardware

Everything else in this note grows from that.


Bits: the smallest unit

A bit is short for binary digit.

A bit can hold one of two values:

  • 0
  • 1

That is the smallest normal unit of information in digital systems.

If one bit can represent two possibilities, then:

  • 2 bits can represent 4 possibilities
  • 3 bits can represent 8 possibilities
  • 4 bits can represent 16 possibilities

In general:

n bits can represent 2^n distinct combinations.

That is one of the most important rules in all of computing.

It explains:

  • why powers of 2 keep appearing
  • why memory sizes are so often related to binary boundaries
  • why CPU word sizes matter
  • why address spaces scale the way they do

Bytes: grouping bits into something practical

A byte is a group of 8 bits.

Why 8?

Historically, computers did not always use 8-bit bytes. Early systems had a variety of word and character sizes.

But over time, 8 bits became the dominant standard because it is a practical size:

  • large enough to encode many common values
  • small enough to handle efficiently
  • convenient for text, numbers, and machine operations

With 8 bits, one byte can represent:

2^8 = 256 possible values

That means one byte can hold values from:

  • 0 to 255 if interpreted as unsigned
  • or other ranges depending on interpretation

The byte became a basic building block for:

  • character encoding
  • memory addressing
  • file sizes
  • machine instructions

So while the bit is the true atomic unit, the byte is the everyday practical unit.


Binary and decimal are both number systems

To understand KB vs KiB, you first need to separate two different questions:

  1. how computers store and process values
  2. how humans choose to write and name quantities

Those are related, but they are not the same thing.

Decimal

The decimal system is base 10.

It uses digits:

  • 0 to 9

Each place represents a power of 10.

Example:

347 = 3*10^2 + 4*10^1 + 7*10^0

Humans use decimal naturally because we write and count in base 10.

Binary

The binary system is base 2.

It uses digits:

  • 0
  • 1

Each place represents a power of 2.

Example:

1011₂ = 1*2^3 + 0*2^2 + 1*2^1 + 1*2^0 = 11₁₀

The subscript notation just means:

  • = binary
  • ₁₀ = decimal

The exact same quantity can be written in different bases.

That is important.

Binary and decimal are different representations, not different realities.


Why powers of 2 show up everywhere

Because digital hardware is built around bits, and each bit doubles the number of possible states.

That means capacity tends to scale like:

  • 2
  • 4
  • 8
  • 16
  • 32
  • 64
  • 128
  • 256
  • 512
  • 1024

This is why you see powers of 2 in:

  • memory sizes
  • register widths
  • address ranges
  • page sizes
  • cache line sizes
  • alignment boundaries
  • instruction set behavior

Once you understand that each added bit doubles the possibilities, many hardware facts become much less mysterious.


A byte is not the same as a character

This is a useful clarification.

People often casually say:

  • one character = one byte

That was often close enough in older ASCII-centric contexts, but it is not universally true.

A byte is just 8 bits of storage.

A character is a text concept.

Depending on encoding:

  • one character may use one byte
  • or multiple bytes

Examples:

  • ASCII characters fit in one byte
  • UTF-8 may use 1 to 4 bytes per character

So bytes measure storage. Characters measure textual meaning.

Do not confuse them.


What KB, MB, and GB mean in decimal

In the decimal system:

  • 1 KB = 1000 bytes
  • 1 MB = 1000 KB = 1,000,000 bytes
  • 1 GB = 1000 MB = 1,000,000,000 bytes
  • 1 TB = 1000 GB = 1,000,000,000,000 bytes

This follows the normal metric pattern used across science and engineering:

  • kilo = 1000
  • mega = 1,000,000
  • giga = 1,000,000,000
  • tera = 1,000,000,000,000

This system is simple and human-friendly in the same way kilometers and kilograms are.


What KiB, MiB, and GiB mean in binary

In the binary system used for these binary-prefixed units:

  • 1 KiB = 1024 bytes
  • 1 MiB = 1024 KiB = 1,048,576 bytes
  • 1 GiB = 1024 MiB = 1,073,741,824 bytes
  • 1 TiB = 1024 GiB

The prefixes mean:

  • Ki = kibi
  • Mi = mebi
  • Gi = gibi
  • Ti = tebi

These names were created to remove ambiguity.

So:

  • KB, MB, GB are decimal units
  • KiB, MiB, GiB are binary units

That is the clean technically correct distinction.


Why 1024 feels close to 1000

Because:

1024 = 2^10

and 2^10 is close to 10^3.

That closeness is exactly what caused decades of confusion.

In binary-oriented hardware contexts, people often informally said:

  • 1 KB and meant 1024 bytes

because 1024 was the nearest convenient power-of-2 quantity to 1000.

That habit lasted a long time.

Later, standards bodies introduced:

  • KiB
  • MiB
  • GiB

to distinguish binary multiples cleanly from decimal metric multiples.

So the confusion did not come from randomness.

It came from a historical shortcut that later needed correction.


Why memory is so often described in powers of 2

Memory systems are deeply tied to binary addressing.

If a machine has n address bits, it can name up to 2^n distinct locations.

That is the key reason powers of 2 dominate memory architecture.

For example:

  • 10 address bits can identify 1024 locations
  • 20 address bits can identify 1,048,576 locations
  • 30 address bits can identify 1,073,741,824 locations

This is why memory capacities and memory boundaries often align naturally with values like:

  • 256
  • 512
  • 1024
  • 4096
  • 65536

They fit the underlying addressing structure cleanly.


What an address actually is

An address is a label used to identify a storage location.

In most modern architectures, memory is byte-addressable.

That means each address refers to one byte.

So if a CPU has a 32-bit address space, it can theoretically address:

2^32 bytes = 4,294,967,296 bytes

That is:

  • 4 GB in decimal-like rounded marketing language
  • or exactly 4 GiB in binary units

This is why older 32-bit systems are strongly associated with a roughly 4-gigabyte address-space limit.

Again, this comes directly from binary counting.


Why CPU architecture cares about powers of 2

CPU architecture is full of binary structure.

Examples:

  • register widths such as 8-bit, 16-bit, 32-bit, 64-bit
  • address widths such as 32-bit or 64-bit
  • instruction fields encoded as bit patterns
  • arithmetic logic circuits working over bit positions
  • flags and control bits represented as single binary states

A 64-bit register can hold:

2^64 distinct bit patterns

A 64-bit processor does not mean only one thing, but it often refers to some combination of:

  • 64-bit registers
  • 64-bit arithmetic capability
  • a large address space model

The key point is that the CPU fundamentally manipulates bit patterns.

Numbers, addresses, characters, colors, instructions, and pointers are all encoded as bits and interpreted according to context.


Binary is not only for numbers

This is an important mental shift.

Bits are not “numbers first.”

Bits are just patterns.

What those patterns mean depends on interpretation.

The same 8-bit pattern could represent:

  • an unsigned integer
  • part of a signed integer
  • a character code
  • a color channel value
  • a machine instruction field
  • a piece of a memory address

So binary is not just a way to write numbers.

It is the universal representation format underneath digital computing.


Why storage devices are often advertised in decimal

Hard drives, SSDs, USB drives, and memory cards are usually marketed with decimal units.

That means:

  • 500 GB usually means 500,000,000,000 bytes
  • 1 TB usually means 1,000,000,000,000 bytes

Why do manufacturers do this?

Because decimal prefixes are standard metric prefixes and produce round, simple-looking numbers.

This is not inherently wrong.

It is correct if the units are understood as decimal.

The confusion happens when a user expects the operating system to show the same number using binary interpretation.

Example:

  • a drive sold as 500 GB has 500,000,000,000 bytes
  • if software divides that by 1024^3, the result is about 465.66 GiB

So the drive did not “lose space.”

The same byte count is just being described with a different unit system.


Why RAM sizes are often thought of in binary terms

RAM sizes historically align more naturally with binary structure because memory chips and address spaces are closely tied to powers of 2.

Examples:

  • 256 MiB
  • 512 MiB
  • 4 GiB
  • 8 GiB
  • 16 GiB

Even when people casually say 8 GB RAM, the internal logic often tracks binary-oriented sizes and boundaries.

In practice, usage is mixed:

  • marketing labels may say GB
  • operating systems and technical documentation may mean either decimal or binary depending on convention

So you must watch the context.

The safest approach is:

  • use GiB and MiB when you mean binary exactly
  • use GB and MB when you mean decimal exactly

Why operating systems have historically confused people

For a long time, many operating systems displayed binary-sized quantities but labeled them with decimal-looking prefixes such as:

  • KB
  • MB
  • GB

So a system might show:

  • 1 KB

while actually meaning:

  • 1024 bytes

That was common historical practice, especially in memory-related contexts.

Some modern systems are more explicit than older ones, but the legacy habit remains widespread in documentation, software tools, and everyday speech.

This is why people often say:

  • “my 1 TB drive shows only 931 GB”

What they usually mean is:

  • the OS is effectively showing about 931 GiB
  • while the manufacturer advertised 1 TB in decimal

That is a unit interpretation mismatch, not missing hardware.


Binary and decimal are both used today

A common beginner mistake is to think one system is right and the other is wrong.

That is not the correct view.

Both are used, but in different contexts.

Binary is especially natural for:

  • memory addressing
  • register sizes
  • page sizes
  • cache sizes and cache lines
  • bit masks and permissions
  • low-level CPU and hardware design
  • many RAM-related quantities

Decimal is especially common for:

  • storage device marketing
  • network speeds in many contexts
  • vendor product labeling
  • human-facing metric capacity descriptions

Mixed usage appears in:

  • operating systems
  • programming tools
  • cloud dashboards
  • documentation

So the practical rule is:

always ask what the unit means in that specific context


Where binary is used in memory

Memory is one of the clearest binary-oriented domains.

Here are the main reasons.

1. Addressing

If memory uses binary addresses, then capacities and ranges naturally follow powers of 2.

2. Allocation boundaries

Many systems allocate or align memory in binary-friendly sizes such as:

  • 8 bytes
  • 16 bytes
  • 64 bytes
  • 4096 bytes

These fit hardware and OS structures well.

3. Pages

Virtual memory is commonly organized in pages, often sizes like:

  • 4 KiB
  • 2 MiB

These are powers of 2 because page indexing and offset calculation become clean in binary.

4. Caches

CPU caches often use binary-sized lines and capacities because indexing and block handling map naturally to bit fields.

So memory design is not “binary” by tradition only.

It is binary because the architecture is fundamentally built around bit-based addressing and partitioning.


Where binary is used in CPU logic

CPU internals are deeply binary.

Examples:

  • arithmetic is performed on binary representations
  • bitwise operations such as AND, OR, XOR, and shifts work directly on bits
  • status flags are individual bits
  • instruction decoding reads fields from bit patterns
  • register contents are just fixed-width binary values

This matters because the CPU does not directly “see” high-level concepts like:

  • integer
  • string
  • file
  • object

It sees bit patterns and applies defined rules.

At higher levels, software assigns meaning to those patterns.


Where decimal is used in storage and data transfer

Storage and communication often prefer decimal prefixes because they are friendlier for product labeling and align with broader metric conventions.

Examples:

  • disk capacity labels
  • SSD product pages
  • USB drive packaging
  • network links such as megabits per second or gigabits per second in vendor descriptions

You should also notice another important distinction here:

  • b = bits
  • B = bytes

So:

  • Mb = megabits
  • MB = megabytes

Those are not the same.

Because:

  • 1 byte = 8 bits

This causes a separate category of confusion from the MB vs MiB issue.

Example:

  • 100 Mbps network speed is 100 megabits per second
  • that is theoretically about 12.5 MB/s before overhead

So always watch both:

  • decimal vs binary
  • bits vs bytes

Why storage hardware is not simply “binary inside, decimal outside”

That statement is too simplistic.

Internally, storage hardware is still digital and still built from binary electronics.

So binary absolutely exists there too.

But when people talk about storage using decimal units, they usually mean:

  • the capacity labeling convention is decimal

That is different from saying the device itself is somehow non-binary inside.

The device still stores and manipulates digital states.

The decimal part is mainly about:

  • naming
  • reporting
  • product communication

So keep these layers separate:

  1. physical digital operation
  2. internal controller and addressing logic
  3. human-facing capacity units

Confusing those layers causes bad explanations.


Why powers of 2 are convenient in architecture

Powers of 2 are not only natural, they are also convenient.

In binary systems, many operations become simpler when sizes align to powers of 2.

Examples:

  • splitting an address into high bits and low bits
  • using low-order bits as offsets within a block
  • aligning data to word boundaries
  • indexing cache sets
  • rounding up allocations

For example, if a page size is 4096 bytes, that is:

4096 = 2^12

So the lower 12 bits of an address can represent the offset within the page.

That is elegant and efficient.

This is one reason architecture and operating systems repeatedly choose power-of-2 sizes.


Signed and unsigned values: the same bits, different meaning

This is a related concept worth understanding.

A pattern of bits does not carry meaning by itself.

For example, 8 bits:

11111111

could mean:

  • 255 as an unsigned integer
  • -1 in two’s complement signed representation

The hardware and software interpretation rules decide the meaning.

This matters because it reinforces a central truth:

bits are representation; interpretation creates semantics

That same principle applies beyond integers to floats, text, pointers, and instructions.


Floating-point numbers are also binary representations

Real numbers such as:

  • 3.14
  • 0.1
  • 1.5

are not stored as literal decimal symbols inside the CPU.

They are usually stored in binary floating-point formats such as IEEE 754.

This is why some decimal fractions cannot be represented exactly in binary floating point.

For example, 0.1 in decimal does not have a finite exact binary representation.

That is a separate topic from KB vs KiB, but it belongs here because it shows again that computers fundamentally represent values in binary, even when humans think in decimal.


Hexadecimal belongs in this conversation too

If you want the whole picture, you should also know hexadecimal.

Hexadecimal is base 16.

It uses:

  • 0 to 9
  • A to F

Why is hex so common in computing?

Because one hex digit corresponds exactly to 4 bits.

So:

  • 2 hex digits = 1 byte
  • 8 hex digits = 32 bits
  • 16 hex digits = 64 bits

Hex is not usually used because hardware works in base 16.

Hardware still works in binary.

Hex is used because it is a compact human-readable shorthand for binary bit patterns.

Example:

11111111₂ = FF₁₆ = 255₁₀

This is why memory dumps, addresses, machine code, and bit masks are so often written in hex.


How files relate to all this

A file is ultimately just a sequence of bytes.

The operating system and programs interpret those bytes according to a format.

Examples:

  • a text file interprets bytes as encoded characters
  • an image file interprets bytes as headers, metadata, and pixel data
  • an executable interprets bytes as machine instructions and related structures

So when a file is listed as:

  • 12 KB
  • 12 KiB

that is just a unit description of how many bytes it contains.

The file’s meaning comes from the format, not from the byte count alone.


Why file systems and block devices use fixed-size units

Storage systems usually work in chunks rather than one arbitrary byte at a time for every internal operation.

Examples:

  • disk sectors
  • filesystem blocks
  • allocation units
  • pages in memory-mapped I/O contexts

These sizes are often powers of 2 because binary alignment is practical for addressing and implementation.

This means a tiny file may occupy more physical storage than its raw byte count, because the filesystem allocates in block-sized units.

That is another place where “logical size” and “storage usage” can differ.

So once again, you must separate:

  • raw bytes of content
  • allocation units
  • displayed human-friendly units

Why “more bits” means “more range” or “more precision”

Bits are capacity for distinction.

If you add more bits, you gain more possible patterns.

That extra pattern space can be used in different ways:

  • larger integer range
  • more addressable memory
  • more color values
  • more instruction encodings
  • more precision in numeric representation

Examples:

  • 8 bits unsigned: 0 to 255
  • 16 bits unsigned: 0 to 65535
  • 32 bits unsigned: 0 to 4,294,967,295

This idea connects unit sizes, CPU widths, and memory limits into one coherent framework.


What “32-bit” and “64-bit” really suggest

These labels are shortcuts, not complete descriptions.

A “32-bit system” or “64-bit system” often refers to architectural characteristics such as:

  • general-purpose register width
  • pointer size
  • address-space model
  • arithmetic capabilities

At a beginner level, the clean way to think about it is:

  • more architectural bits generally allow larger directly represented values and larger address spaces
  • but the exact practical limits depend on the architecture and operating system design

So do not reduce the whole idea to one slogan like:

  • “64-bit means faster”
  • or “64-bit means unlimited memory”

The true point is that bit width shapes representation capacity and addressing capability.


The cleanest way to think about KB vs KiB

If you want one mental rule that keeps you out of trouble, use this:

Decimal units

Use when you mean powers of 10:

  • KB = 1000 bytes
  • MB = 1,000,000 bytes
  • GB = 1,000,000,000 bytes

Binary units

Use when you mean powers of 2:

  • KiB = 1024 bytes
  • MiB = 1,048,576 bytes
  • GiB = 1,073,741,824 bytes

Then ask:

  • is this memory context?
  • storage marketing context?
  • OS reporting context?
  • hardware architecture context?

That usually resolves the ambiguity.


Common beginner confusions

1. “Why not just use decimal everywhere?”

Because the underlying architecture is binary, and many important capacities naturally align to powers of 2.

2. “Why not just use binary everywhere?”

Because decimal prefixes are standardized, familiar, and convenient for many human-facing quantities and product labels.

3. “Is a manufacturer lying when my 1 TB disk shows less?”

Usually no.

They are typically using decimal correctly, while the software may be displaying the same byte count in binary-style interpretation.

4. “Is RAM decimal or binary?”

Conceptually, RAM is strongly binary-oriented, but labels in the real world may mix conventions.

5. “Does binary only matter for hardware engineers?”

No.

It matters for:

  • memory usage
  • file sizes
  • performance
  • networking
  • systems programming
  • debugging
  • reading technical documentation correctly

6. “Is MB always wrong?”

No.

MB is correct for decimal megabytes.

The problem is not the symbol itself.

The problem is using it ambiguously.


A practical map of where each concept lives

Representation level

Core ideas:

  • bits
  • bytes
  • binary patterns
  • signed vs unsigned interpretation
  • floating-point encoding

CPU level

Core ideas:

  • registers
  • word sizes
  • instruction encoding
  • arithmetic and bitwise operations
  • flags and control bits

Memory level

Core ideas:

  • byte addressing
  • pages
  • alignment
  • caches
  • power-of-2 boundaries

Storage level

Core ideas:

  • files as byte sequences
  • blocks and sectors
  • allocation units
  • device capacities
  • decimal marketing units

Human-facing unit level

Core ideas:

  • KB, MB, GB
  • KiB, MiB, GiB
  • bits vs bytes
  • decimal vs binary naming

When you separate the topic this way, it becomes much easier to reason about what is going on.


The most important conceptual thread

If you want everything in one flow, it is this:

Digital hardware naturally uses two-state logic, so information is encoded in bits. Bits are grouped into bytes, and larger structures are built from those bytes. Because each added bit doubles the number of possible states, powers of 2 appear throughout CPU architecture, memory addressing, alignment, pages, caches, and capacity limits. Humans, however, often describe large quantities using decimal metric prefixes such as KB, MB, and GB, while binary-oriented technical contexts naturally produce quantities like 1024, 1,048,576, and 1,073,741,824, which are captured precisely by KiB, MiB, and GiB. Storage products are often labeled with decimal units, while memory and architecture are more naturally explained with binary structure. The confusion disappears once you distinguish underlying binary representation from human naming conventions.


What you should come away knowing

You should leave this topic with these ideas clearly separated in your head:

  1. Bits are the fundamental binary units.
  2. Bytes are practical 8-bit groups used everywhere.
  3. Powers of 2 appear because adding one bit doubles the number of possible states.
  4. Binary is natural for hardware, memory, addressing, and low-level architecture.
  5. Decimal is common for human-facing labeling, especially storage capacities.
  6. KB, MB, GB are decimal units.
  7. KiB, MiB, GiB are binary units.
  8. A file, memory region, register, or address is ultimately about bit patterns interpreted in context.
  9. CPU, memory, and storage all use binary electronics underneath, even when the visible capacity labels are decimal.
  10. Most confusion comes from mixing representation, architecture, and naming into one blurry idea.

Bottom line

Computers are binary at the foundation because digital electronics reliably represent two states. That leads directly to bits, bytes, powers of 2, binary addressing, register widths, memory pages, and architectural boundaries. Humans, however, often describe large capacities using decimal metric prefixes, which is why KB and MB coexist with KiB and MiB. Memory and CPU architecture are most naturally understood through binary structure, while storage products are often labeled in decimal terms. The topic becomes clear once you distinguish three layers: the binary reality of representation, the architectural structures built from that reality, and the human unit conventions used to describe capacity.