Programming terminology: Byte

Once you know what a bit means when it comes to programming, the byte is just one step away...

Byte structure

Basically, a byte - with regard to computer systems or microcontrollers and related digital signal processing - is just a group of eight bits. These bits directly follow each other with regard to their location within memory, cpu register, serial data etc.

Numerical representation

Similar to the bit, the byte is based on the binary system, as all eight bits can be zero or one in value (turned off or on).

Since binary numbers can get pretty long quickly (with each of the positions representing a value to the power of two), byte-values are typically represented with the help of the hexadecimal system. Since the hexadecimal system uses the numbers from zero to nine and the alphabet characters from "A" to "F", a single number or character can represent the decimal values from zero to 15 - which is equivalent to the what you can represent with eight binary numbers:

Decimal value Binary number Hexadecimal number
0 0000 0
1 0001 1
2 0010 2
3 0011 3
4 0100 4
5 0101 5
6 0110 6
7 0111 7
8 1000 8
9 1001 9
10 1010 A
11 1011 B
12 1100 C
13 1101 D
14 1110 E
15 1111 F

A single character hexadecimal value like in the above represents just one half of a byte - either the lower (values zero to fifteen) or the higher part (values sixteen and above). This "half-byte" is called a "nibble" - although this term is seldomly used these days (especially since data processing uses not just single bytes, but mega-, giga- or tera-bytes).

Just for completion, here is the table with the full byte values:

Decimal value Binary number Hexadecimal number
0000000000000
0010000000101
0020000001002
0030000001103
0040000010004
0050000010105
0060000011006
0070000011107
0080000100008
0090000100109
010000010100A
011000010110B
012000011000C
013000011010D
014000011100E
015000011110F
0160001000010
0170001000111
0180001001012
0190001001113
0200001010014
0210001010115
0220001011016
0230001011117
0240001100018
0250001100119
026000110101A
027000110111B
028000111001C
029000111011D
030000111101E
031000111111F
0320010000020
0330010000121
0340010001022
0350010001123
0360010010024
0370010010125
0380010011026
0390010011127
0400010100028
0410010100129
042001010102A
043001010112B
044001011002C
045001011012D
046001011102E
047001011112F
0480011000030
0490011000131
0500011001032
0510011001133
0520011010034
0530011010135
0540011011036
0550011011137
0560011100038
0570011100139
058001110103A
059001110113B
060001111003C
061001111013D
062001111103E
063001111113F
0640100000040
0650100000141
0660100001042
0670100001143
0680100010044
0690100010145
0700100011046
0710100011147
0720100100048
0730100100149
074010010104A
075010010114B
076010011004C
077010011014D
078010011104E
079010011114F
0800101000050
0810101000151
0820101001052
0830101001153
0840101010054
0850101010155
0860101011056
0870101011157
0880101100058
0890101100159
090010110105A
091010110115B
092010111005C
093010111015D
094010111105E
095010111115F
0960110000060
0970110000161
0980110001062
0990110001163
1000110010064
1010110010165
1020110011066
1030110011167
1040110100068
1050110100169
106011010106A
107011010116B
108011011006C
109011011016D
110011011106E
111011011116F
1120111000070
1130111000171
1140111001072
1150111001173
1160111010074
1170111010175
1180111011076
1190111011177
1200111100078
1210111100179
122011110107A
123011110117B
124011111007C
125011111017D
126011111107E
127011111117F
1281000000080
1291000000181
1301000001082
1311000001183
1321000010084
1331000010185
1341000011086
1351000011187
1361000100088
1371000100189
138100010108A
139100010118B
140100011008C
141100011018D
142100011108E
143100011118F
1441001000090
1451001000191
1461001001092
1471001001193
1481001010094
1491001010195
1501001011096
1511001011197
1521001100098
1531001100199
154100110109A
155100110119B
156100111009C
157100111019D
158100111109E
159100111119F
16010100000A0
16110100001A1
16210100010A2
16310100011A3
16410100100A4
16510100101A5
16610100110A6
16710100111A7
16810101000A8
16910101001A9
17010101010AA
17110101011AB
17210101100AC
17310101101AD
17410101110AE
17510101111AF
17610110000B0
17710110001B1
17810110010B2
17910110011B3
18010110100B4
18110110101B5
18210110110B6
18310110111B7
18410111000B8
18510111001B9
18610111010BA
18710111011BB
18810111100BC
18910111101BD
19010111110BE
19110111111BF
19211000000C0
19311000001C1
19411000010C2
19511000011C3
19611000100C4
19711000101C5
19811000110C6
19911000111C7
20011001000C8
20111001001C9
20211001010CA
20311001011CB
20411001100CC
20511001101CD
20611001110CE
20711001111CF
20811010000D0
20911010001D1
21011010010D2
21111010011D3
21211010100D4
21311010101D5
21411010110D6
21511010111D7
21611011000D8
21711011001D9
21811011010DA
21911011011DB
22011011100DC
22111011101DD
22211011110DE
22311011111DF
22411100000E0
22511100001E1
22611100010E2
22711100011E3
22811100100E4
22911100101E5
23011100110E6
23111100111E7
23211101000E8
23311101001E9
23411101010EA
23511101011EB
23611101100EC
23711101101ED
23811101110EE
23911101111EF
24011110000F0
24111110001F1
24211110010F2
24311110011F3
24411110100F4
24511110101F5
24611110110F6
24711110111F7
24811111000F8
24911111001F9
25011111010FA
25111111011FB
25211111100FC
25311111101FD
25411111110FE
25511111111FF

Byte processing

Early (personal and home) computers used 8-bit CPUs, so single byte values were used for most computing within the CPU. Since then, CPU technology (and the technologiy surrounding them) has progressed to 16-, 32- and currently 64-bit processor architectures. Thanks to this development, computers can handle larger numbers and address more memory, and thanks to faster processing speeds and parallel processing, data can be handled in bigger chunks ever faster. 

Still, blocks of processed data (or instructions) build up on top of bytes - just more of them at any one time.

And this is the reason why all the data-size related values for memory - either on a chip or on an external digital storage medium - still use bytes to describe the actual usable capacity:

  • kilobyte: 1.024 bytes (since the base is binary, and each byte is made up of 8 bits, and 1.024 is 2 to the power of 10)
  • megabyte: 1.024 kilobytes = 1.024 x 1.024 bytes = 1.048.576 bytes
  • gigabyte: 1.024 megabytes = 1.024 x 1.024 kilobytes = 1.024 x 1.024 x 1.024 bytes = 1.073.741.824 bytes
  • terabyte: 1.024 gigabytes (1.099.511.627.776 bytes)
  • petabyte: 1.024 terabytes (2 to the power of 50 bytes = 1.125.899.906.842.624 bytes)
  • exabyte: 1.024 petabytes

There is a nice article on the Lifewire website on the topic of computer-related data / storage sizes which you can find here. Naturally, they don't mention the nibble (half-byte) since this is not really used for direct computing (even not during 8-bit times when it was more useful).

Internal usage

One thing you have to remember - especially when you are working on more low-level stuff, maybe even in the Assembler programming language - is that byte-values are used to represent everything inside the computer: computing instructions, data that has to be processed, memory adresses etc.

Thankfully, hardware and BIOS create an ordered structure, so when the system is started, the computer knows where to start. The CPU instruction set - which is realized by the internal electronic circuits on the chip - then acts as a commando interpreter, which identifies the initial commands and executes them, processing following data values. This is all done on the hardware level, and forms the basis of every operating system and program.

Every program is - at the lowest level - just a big block of bytes, with commands and data all following each other in a format that the CPU can understand and execute.