Octal (Base8 )

Why learn the Octal (Base8 ) number system?

Hexadecimal is most often used as a shorthand for binary numbers, but octal is sometimes used as a shorthand for binary as well. Converting from octal-to-binary and from binary-to-octal is sometimes necessary when working with computer and network systems. One octal digit can be used to represent three binary digits or bits.

Binary
Value
Octal
Value
Decimal
Value
000 0 0
001 1 1
010 2 2
011 3 3
100 4 4
101 5 5
110 6 6
111 7 7


What is the Octal (Base8 ) number system?

The octal base8 number system consists of two elements:

  1. Eight digits are used in the number system (i.e., 0 through 7).
  2. Each column represents a value based on a factor of 8.
Octal
Digits
1st Four Columns
in Decimal

Octal Column
Conversion to Decimal

0-7 or 83 82 81 80

Octal 12348 converted to Decimal equals
 (1x512)+(2x64)+(3x8)+(4x1) = 668

512 64 8 1

 

Octal Column Conversion to Binary

Octal 12348 converted to Binary = 0010100111002

Each Octal Digit 1 2 3 4
= Three Binary Digits or Bits 001 010  011 100

How does the Octal (Base8 ) number system work?

Counting in Octal (Base8)

The standard unit of storage in computing is a byte. A byte consists of 8 bits. A byte can contain the decimal values 0-255 for a total of 256 different numbers or bit combinations. Below is a table that counts through all the possible bit combinations in a byte (decimal values 0-255, octal values 000-377).

Decimal
Base10
Octal
Base8
Decimal
Base10
Octal
Base8
Decimal
Base10
Octal
Base8
Decimal
Base10
Octal
Base8
0 000 64 100 128 200 192 300
1 001 65 101 129 201 193 301
2 002 66 102 130 202 194 302
3 003 67 103 131 203 195 303
4 004 68 104 132 204 196 304
5 005 69 105 133 205 197 305
6 006 70 106 134 206 198 306
7 007 71 107 135 207 199 307
8 010 72 110 136 210 200 310
9 011 73 111 137 211 201 311
10 012 74 112 138 212 202 312
11 013 75 113 139 213 203 313
12 014 76 114 140 214 204 314
13 015 77 115 141 215 205 315
14 016 78 116 142 216 206 316
15 017 79 117 143 217 207 317
16 020 80 120 144 220 208 320
17 021 81 121 145 221 209 321
18 022 82 122 146 222 210 322
19 023 83 123 147 223 211 323
20 024 84 124 148 224 212 324
21 025 85 125 149 225 213 325
22 026 86 126 150 226 214 326
23 027 87 127 151 227 215 327
24 030 88 130 152 230 216 330
25 031 89 131 153 231 217 331
26 032 90 132 154 232 218 332
27 033 91 133 155 233 219 333
28 034 92 134 156 234 220 334
29 035 93 135 157 235 221 335
30 036 94 136 158 236 222 336
31 037 95 137 159 237 223 337
32 040 96 140 160 240 224 340
33 041 97 141 161 241 225 341
34 042 98 142 162 242 226 342
35 043 99 143 163 243 227 343
36 044 100 144 164 244 228 344
37 045 101 145 165 245 229 345
38 046 102 146 166 246 230 346
39 047 103 147 167 247 231 347
40 050 104 150 168 250 232 350
41 051 105 151 169 251 233 351
42 052 106 152 170 252 234 352
43 053 107 153 171 253 235 353
44 054 108 154 172 254 236 354
45 055 109 155 173 255 237 355
46 056 110 156 174 256 238 356
47 057 111 157 175 257 239 357
48 060 112 160 176 260 240 360
49 061 113 161 177 261 241 361
50 062 114 162 178 262 242 362
51 063 115 163 179 263 243 363
52 064 116 164 180 264 244 364
53 065 117 165 181 265 245 365
54 066 118 166 182 266 246 366
55 067 119 167 183 267 247 367
56 070 120 170 184 270 248 370
57 071 121 171 185 271 249 371
58 072 122 172 186 272 250 372
59 073 123 173 187 273 251 373
60 074 124 174 188 274 252 374
61 075 125 175 189 275 253 375
62 076 126 176 190 276 254 376
63 077 127 177 191 277 255 377

Column Values in Octal (Base8)
For the base8 octal number system, the 1st four columns look like the following (note that these four columns also represent twelve bits):

Power 83 82 81 80
Value 512 64 8 1
Column 4th 3rd 2nd 1st

For the value of the 1st column, the base is raised to the power of zero (i.e., 80). To get the next column value, one is added to the power of the current column (i.e., 81 for the 2nd column, 82 for the 3rd column, 83 for the 4th column, etc.). Powers or exponents simply determine how many times the number should be multiplied by itself (note that the powers of zero and one are an exception).

80 = 1, any number raised to the power of zero is 1
81 = 8, any number raised to the power of one is the number itself
82 = 8 x 8 = 64
83 = 8 x 8 x 8 = 512

The decimal equivalent of the base8 octal number 13768 is:
(1x512)+(3x64)+(7x8)+(6x1) = 766

83 82 81 80 = 766
512 64 8 1
1 3 7 6

The rightmost or 1st column indicates 6 ones.   6
The 2nd column indicates 7 eights. + 56
The 3rd column indicates 3 sixty-fours. + 192
The 4th column indicates 1 five-hundred-twelve. + 512
Adding these values together produces the decimal value   766

In any base system, the next column value to the left can be found by multiplying the current column value by the base number. This works because one is being added to the exponent for the next column. Adding one to the exponent means that the base should be multiplied by itself one more time. In the base8 octal number system, to get the column value of the next column, just multiply the current column value by 8.

Power 83 82 81 80
Value 8 x 64 = 512 8 x 8 = 64 8 x 1 = 8 1
Column 4th 3rd 2nd 1st

It's easy to extend the column values of a octal number by either adding one to the power of the current column or multiplying the current column by eight. Here's what the column values are for a 24-bit or 3-byte octal number.

Power 87 86 85 84 83 82 81 80
Value 2,097,152 262,144 32,768 4,096 512 64 8 1
Column 8th 7th 6th 5th 4th 3rd 2nd 1st

Because the column values begin to get quite large, it makes sense to begin using a shorthand to indicate these larger values. The number 1024 can be represented by Kilo (K). The number 1024K can be represented by Meg (M). Using this shorthand makes the multiples of 1024 much easier to remember. Below is the same table using K to represent 1024 and M to represent 1024K.

Power 87 86 85 84 83 82 81 80
Value 2M 256K 32K 4K 512 64 8 1
Column 8th 7th 6th 5th 4th 3rd 2nd 1st

Here's what 4K and above mean:
4K = 4 x 1024 = 4,096
32K = 32 x 1024 = 32,768
256K = 256 x 1024 = 262,144
2M = 2 x 1024K = 2,097,152

Often in computing, K is rounded to 1,000. Although this isn't quite accurate, it does make it easier to compare numbers when rough values are all that's needed. Note that many numeric shorthand letters in computing are based on the same concept as K (i.e., 1024K = 1Meg or 1M or roughly 1 million, 1024M = 1Gig or 1G or roughly 1 billion).

The decimal equivalent of the 24-bit or 3-byte base8 octal number 145673208 is:
(1x2M)+(4x256K)+(5x32K)+(6x4K)+(7x512)+(3x64)+(2x8)+(0x1) = 3,337,936

87 86 85 84 83 82 81 80 = 3,337,936
2M 256K 32K 4K 512 64 8 1
1 4 5 6 7 3 2 0

The rightmost or 1st column indicates 0 ones.   0
The 2nd column indicates 2 eights. + 16
The 3rd column indicates 3 sixty-fours. + 192
The 4th column indicates 7 five-hundred-twelves. + 3,584
The 5th column indicates 6 4K's (4,096's). + 24,576
The 6th column indicates 5 32K's (32,768's). + 163,840
The 7th column indicates 4 256K's (262,144's). + 1,048,576
The 8th column indicates 1 2M's (2,097,152's). + 2,097,152
Adding these values together produces the decimal value   3,337,936

Fortunately, octal is most often used as a shorthand for binary. It is usually not necessary to convert from octal-to-decimal or vice versa. However, it is often necessary to convert between octal and binary.

Converting from Octal (Base8) to Binary (Base2)

Determining the binary value of an octal number simply requires converting each octal digit to three binary digits or bits. For example, the binary equivalent of the base8 octal number 14758 is 0011001111012.

Octal
Digit
Binary
Digits (Bits)
1 001
4 100
7 111
5 101

Method: Convert each octal digit to a 3-bit binary number and combine all the binary numbers.

For example, determining the binary equivalent of the octal number 23608 requires that the four octal digits 2, 3, 6 and 0 be converted to four 3-bit binary numbers.

The leftmost digit of the octal number 23608 is 2. Converting 2 in octal to a 3-bit binary number produces 0102.

22 21 20 = 2
4 2 1
0 1 0

The next digit of the octal number 23608 is 3. Converting 3 in octal to a 3-bit binary number produces 0112.

22 21 20 = 2 + 1 = 3
4 2 1
0 1 1

The next digit of the octal number 23608 is 6. Converting 6 in octal to a 3-bit binary number produces 1102.

22 21 20 = 4 + 2 = 6
4 2 1
1 1 0

The last digit of the octal number 23608 is 0. Converting 0 in octal to a 3-bit binary number produces 0002.

22 21 20 = 0
4 2 1
0 0 0

The four 3-bit binary numbers together are 010 011 110 000.
Octal number 23608 = 0100111100002 in binary.

Converting from Binary (Base2) to Octal (Base8)

Determining the octal value of a binary number simply requires converting every three binary digits or bits to a single octal digit. For example, the octal equivalent of the base2 binary number 1110101010012 is 72518.

Binary
Digits (Bits)
Hexadecimal
Digit
111 7
010 2
101 5
001 1

Method: Convert every three bits  to an octal digit and combine all the octal digits.

For example, determining the octal equivalent of the binary number 110101111102 requires that every three bits 011, 010, 111 and 110 be converted to an octal digit. Notice that the bits must be counted from the right, then if needed, the leftmost set of bits are padded with leading zeros to create three bits for that set.

The leftmost three bits of the binary number 11 010 111 1102 are 011 (note that the leading zero was added to 11 to pad out to three bits). Binary 0112 converts to octal 38.

22 21 20 = 2 + 1 = 38
4 2 1
0 1 1

The next three bits of the binary number 11 010 111 1102 are 010. Binary 0102 converts to octal 28.

22 21 20 = 28
4 2 1
0 1 0

The next three bits of the binary number 11 010 111 1102 are 111. Binary 1112 converts to octal 78.

22 21 20 = 4 + 2 + 1 = 78
4 2 1
1 1 1

The last three bits of the binary number 11 010 111 1102 are 110. Binary 1102 converts to octal 68.

22 21 20 = 4 + 2 = 68
4 2 1
1 1 0

Combining the four octal digits gives the result 3276.
Binary 110101111102 = Octal 32768

Back to Understanding and Converting Base Number Systems