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

000

00000000

00

001

00000001

01

002

00000010

02

003

00000011

03

004

00000100

04

005

00000101

05

006

00000110

06

007

00000111

07

008

00001000

08

009

00001001

09

010

00001010

0A

011

00001011

0B

012

00001100

0C

013

00001101

0D

014

00001110

0E

015

00001111

0F

016

00010000

10

017

00010001

11

018

00010010

12

019

00010011

13

020

00010100

14

021

00010101

15

022

00010110

16

023

00010111

17

024

00011000

18

025

00011001

19

026

00011010

1A

027

00011011

1B

028

00011100

1C

029

00011101

1D

030

00011110

1E

031

00011111

1F

032

00100000

20

033

00100001

21

034

00100010

22

035

00100011

23

036

00100100

24

037

00100101

25

038

00100110

26

039

00100111

27

040

00101000

28

041

00101001

29

042

00101010

2A

043

00101011

2B

044

00101100

2C

045

00101101

2D

046

00101110

2E

047

00101111

2F

048

00110000

30

049

00110001

31

050

00110010

32

051

00110011

33

052

00110100

34

053

00110101

35

054

00110110

36

055

00110111

37

056

00111000

38

057

00111001

39

058

00111010

3A

059

00111011

3B

060

00111100

3C

061

00111101

3D

062

00111110

3E

063

00111111

3F

064

01000000

40

065

01000001

41

066

01000010

42

067

01000011

43

068

01000100

44

069

01000101

45

070

01000110

46

071

01000111

47

072

01001000

48

073

01001001

49

074

01001010

4A

075

01001011

4B

076

01001100

4C

077

01001101

4D

078

01001110

4E

079

01001111

4F

080

01010000

50

081

01010001

51

082

01010010

52

083

01010011

53

084

01010100

54

085

01010101

55

086

01010110

56

087

01010111

57

088

01011000

58

089

01011001

59

090

01011010

5A

091

01011011

5B

092

01011100

5C

093

01011101

5D

094

01011110

5E

095

01011111

5F

096

01100000

60

097

01100001

61

098

01100010

62

099

01100011

63

100

01100100

64

101

01100101

65

102

01100110

66

103

01100111

67

104

01101000

68

105

01101001

69

106

01101010

6A

107

01101011

6B

108

01101100

6C

109

01101101

6D

110

01101110

6E

111

01101111

6F

112

01110000

70

113

01110001

71

114

01110010

72

115

01110011

73

116

01110100

74

117

01110101

75

118

01110110

76

119

01110111

77

120

01111000

78

121

01111001

79

122

01111010

7A

123

01111011

7B

124

01111100

7C

125

01111101

7D

126

01111110

7E

127

01111111

7F

128

10000000

80

129

10000001

81

130

10000010

82

131

10000011

83

132

10000100

84

133

10000101

85

134

10000110

86

135

10000111

87

136

10001000

88

137

10001001

89

138

10001010

8A

139

10001011

8B

140

10001100

8C

141

10001101

8D

142

10001110

8E

143

10001111

8F

144

10010000

90

145

10010001

91

146

10010010

92

147

10010011

93

148

10010100

94

149

10010101

95

150

10010110

96

151

10010111

97

152

10011000

98

153

10011001

99

154

10011010

9A

155

10011011

9B

156

10011100

9C

157

10011101

9D

158

10011110

9E

159

10011111

9F

160

10100000

A0

161

10100001

A1

162

10100010

A2

163

10100011

A3

164

10100100

A4

165

10100101

A5

166

10100110

A6

167

10100111

A7

168

10101000

A8

169

10101001

A9

170

10101010

AA

171

10101011

AB

172

10101100

AC

173

10101101

AD

174

10101110

AE

175

10101111

AF

176

10110000

B0

177

10110001

B1

178

10110010

B2

179

10110011

B3

180

10110100

B4

181

10110101

B5

182

10110110

B6

183

10110111

B7

184

10111000

B8

185

10111001

B9

186

10111010

BA

187

10111011

BB

188

10111100

BC

189

10111101

BD

190

10111110

BE

191

10111111

BF

192

11000000

C0

193

11000001

C1

194

11000010

C2

195

11000011

C3

196

11000100

C4

197

11000101

C5

198

11000110

C6

199

11000111

C7

200

11001000

C8

201

11001001

C9

202

11001010

CA

203

11001011

CB

204

11001100

CC

205

11001101

CD

206

11001110

CE

207

11001111

CF

208

11010000

D0

209

11010001

D1

210

11010010

D2

211

11010011

D3

212

11010100

D4

213

11010101

D5

214

11010110

D6

215

11010111

D7

216

11011000

D8

217

11011001

D9

218

11011010

DA

219

11011011

DB

220

11011100

DC

221

11011101

DD

222

11011110

DE

223

11011111

DF

224

11100000

E0

225

11100001

E1

226

11100010

E2

227

11100011

E3

228

11100100

E4

229

11100101

E5

230

11100110

E6

231

11100111

E7

232

11101000

E8

233

11101001

E9

234

11101010

EA

235

11101011

EB

236

11101100

EC

237

11101101

ED

238

11101110

EE

239

11101111

EF

240

11110000

F0

241

11110001

F1

242

11110010

F2

243

11110011

F3

244

11110100

F4

245

11110101

F5

246

11110110

F6

247

11110111

F7

248

11111000

F8

249

11111001

F9

250

11111010

FA

251

11111011

FB

252

11111100

FC

253

11111101

FD

254

11111110

FE

255

11111111

FF

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)

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.