Network Basics: TCP/UDP Socket and Port Overview Cisco Adaptive Security Appliance (ASA) Configuration: Interfaces Networking Cable Basics

# Cisco Networking: Converting Binary to Base 8 (Octal)

Binary to octal conversions are actually quite easy, easier than binary to Base 10 conversion. This is due to the fact that octal numbers can be managed by simply grouping your binary numbers in sets of three. For example, start with the binary number, 11010011, from the preceding section, which resulted from the conversion from the decimal number of 215. Because 11010111 is only eight digits, add a leading zero to make this easier: 011010111.

By breaking this number into groups of three bits, you get 011, 010, and 111. Each of these three-bit binary numbers can now be converted into a number between zero and seven depending on the positions of the bits. After you convert these three groups of bits, your results should be 3 (from 011), 2 (from 010), and 7 (from 111), so the octal number is 327.

If you have been trying the binary to decimal conversions, converting binary numbers to octal, which are only three bits long, is easier.

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

Converting from octal to binary is not really any more difficult because each octal digit simply expands to three binary digits. For example, if you are given an octal number like 247, break it apart to 2, 4, and 7. Then convert each digit to 010, 100, and 111, giving you a total of 010100111. The byte length value (minus the zero, that is) would be 10100111.

You may be thinking that this was fairly easy; however, it was easy only because binary matches up nicely with octal (Base 8) and hexadecimal (Base 16), as you will see in the next section, but not decimal (Base 10). Remember, 10 works well for humans, but 10 is not a natural binary number, whereas 4, 8, 16, and 32 are.