The binary system consists of numbers expressed by combinations of the digits one and zero. In 1937, Claude Shannon realized that the on/off states of electrical circuits could correspond to the true/false states of logic. He introduced the idea that Boolean logic could be combined with the binary representation of truth-values for developing circuitry. Even with the development of modern computers, the binary system is a fundamental part of modern circuitry. The binary system and the related octal and hexadecimal systems are commonplace in many computer-related fields. Converting between number systems is therefore an important skill for anyone working with computers.

## General Base Conversions

Divide the number to be converted by the desired base. Using standard division notation, write the quotient as a whole number above the dividend with the remainder to the right of the quotient. For example, to convert the number 12 to binary (base 2), divide 12 by 2, which results in a quotient of 6 with a remainder of 0.

Make another division symbol over the quotient and divide by the base again. Repeat this process with each resulting quotient until you have a quotient of 0. For example, continuing to divide 2 into 6 gives you 3 with a remainder of 0, then 1 with a remainder of 1, and then 0 with a remainder of 1.

Rewrite each remainder using the number system that you are converting to if the base is greater than the one you are converting from. Unless you are trying to convert from a non-decimal base, this will only apply when converting to bases greater than 10. The hexadecimal system (base 16) uses the letters A, B, C, D, E and F to represent the numbers 10, 11, 12, 13, 14 and 15, respectively. Therefore, if you are converting to hexadecimal, you will rewrite each remainder with a value of 10 or higher, using the appropriate letter.

Write the remainders down as the digits of a single number, starting with the last remainder and ending with the first. This is your converted number. In the example given, four remainders are found: 1100. This is the binary equivalent to the number 12.

This method works for converting from any base to any other base. However, converting from a non-decimal base requires doing math with a non-decimal number system. For example, 1100 can be converted back to 12 if you know how to do binary math. For this reason, it is convenient to have another method to convert non-decimal bases to decimal.

## Conversions to Decimal

Write out the powers of the base from right to left, starting with the base raised to the power of 0. The powers increase sequentially from right to left. You only need the same amount of powers as the amount of digits that the number in question contains. For example, the octal (base 8) number 2154 has four digits, so the powers are 8^3, 8^2, 8^1, 8^0.

Evaluate each of the powers listed. In the example given, the powers evaluate to 512, 64, 8 and 1.

Multiply each digit by its corresponding power and find the sum of these products. For bases greater than 10, convert the digits to their decimal equivalents before multiplying. The resulting sum is the decimal value of the given number. For example, the octal number 2154 = 2_512 + 1_64 + 5_8 + 4_1 = 1132 in decimal.

## Conversions From Binary to Octal or Hexadecimal

Write the binary number with a space after every third or fourth digit, depending on whether you are converting to octal or hexadecimal, starting from the right. When converting to octal, put the space after every third digit (for hexadecimal, put the space after every fourth digit). This creates little packets of binary digits. For example, to convert to hexadecimal, rewrite the binary number 1101010 as 110 1010. Notice that the first packet only has three digits, because the counting of four digits started from the right.

Convert each packet to its octal or hexadecimal equivalent. Three binary digits have a range in value from 0 to 7, which is the same range for an octal digit. In the same way, four binary digits range from 0 to 15, the same range as hexadecimal digits. Remember to use the powers of two when converting from binary: 8, 4, 2 and 1. For example, the first packet 110 equals 1_4 + 1_2 + 0_1 = 6. The second packet 1010 equals 1_8 + 0_4 + 1_2 + 0*1 = 10, which is the hexadecimal value A.

Write the hexadecimal digits as a single number. In the example given, 1101010 is 6A in hexadecimal. Converting from binary to hexadecimal is much easier than converting from binary to decimal, because there is no binary packet size corresponding to the values 0 to 9. For that reason, hexadecimal is very convenient as a shorthand way to write otherwise very long binary numbers.

Notice that converting from octal or hexadecimal is just the opposite from converting to them. Write each digit as a three- or four-digit binary packet, and then scrunch them together as one number. For example, the octal number 2154 = 10 001 101 100. Scrunching them together gives the binary number 10001101100.