In digital systems, the bit width determines how much information can be stored in a single value. Common widths are 8-bit (1 byte), 16-bit (2 bytes), and 32-bit (4 bytes). Each increase in width allows for a larger range of values but also requires more memory storage.
8-bit Value
Binary:
0011 1001
Hex:
0x39
Decimal:
57
Range:
0 to 255
Memory: 1 byte
16-bit Value
Binary:
0011 0000 0011 1001
Hex:
0x3039
Decimal:
12345
Range:
0 to 65,535
Memory: 2 bytes
32-bit Value
Binary:
0000 0000 0000 0000 0011 0000 0011 1001
Hex:
0x00003039
Decimal:
12345
Range:
0 to 4,294,967,295
Memory: 4 bytes
Common Uses
8-bit (1 byte)
ASCII characters
Small integers
Status flags
Color components (RGB)
16-bit (2 bytes)
Unicode characters
Audio samples
Medium integers
Network ports
32-bit (4 bytes)
Large integers
IPv4 addresses
Single-precision float
Color with alpha (RGBA)
Key Concepts
Each additional bit doubles the range of possible values
Unsigned values start from 0, signed values can be negative
Memory alignment often requires values to be stored in their natural size
Choosing the right bit width is important for both functionality and efficiency