## Binary Numbering System

Binary is a base 2 numbering system which is made up of two numbers: 0 and 1.  0 means OFF and 1 means ON.  The computer’s central processing unit (CPU) only recognizes these two states – ON and OFF.  It is the foundation for all binary code, which is used in computer and digital systems.

## Bits and Bytes

A binary digit called bit is the smallest unit of data in a computer.  Each bit has a single value which is either 0 or 1.  8 bits (b) is equivalent to 1 byte (B).

Hexadecimal is a base 16 numbering system which is made up of 16 digits: 0 – 9 and six more, which is A through F.

Hexadecimal numbering system is often used by programmers to simplify the binary numbering system.  Since 16 is equivalent to 24, there is a linear relationship between the numbers 2 and 16.  This means that one hexadecimal digit is equivalent to four binary digits.  Computers use binary numbering system while humans use hexadecimal numbering system to shorten binary and make it easier to understand.

## Conversion from Binary to Hexadecimal

Conversion can be done in two ways:

### Basic Conversion

This is used for binary numbers with four or less digits.

1. Start with four binary numbers to convert. If the binary has less than 4 digits, just add zeroes to the front to make it 4 digits. For example: 1010. If you have 01, make it 0001.
2. Put the binary number on the power of 2 columns as follows:
 Exponent Value Binary 23 22 21 20 8 4 2 1 1 0 1 0
3. Take the corresponding value of each binary digit equal to 1 and add to get the total value. The total value corresponds to the decimal equivalent.Total value = (8 + 2) = 10So binary number 1010 is 10 in decimal number.
4. Convert decimal to hexadecimal.Decimal number 10 is A in hexadecimal.  Refer to the table below.So binary number 1010 is equivalent to A in hexadecimal.
0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
A 10
B 11
C 12
D 13
E 14
F 15

### Conversion of Long Binary Numbers

This is used for binary numbers with more than four digits.

1. Break the string of binary numbers into groups of four, from right to left. If the leftmost binary has less than 4 digits, just add zeroes to the front to make it 4 digits.Example: 1110110010100111 1011 0010 1001(0011) (1011) (0010) (1001)
2. Convert each group at a time using the Basic Conversion method discussed earlier.0011 = (2 + 1) = 31011 = (8 + 2 + 1) = 11 = B0010 = 2
1001 = (8+1) = 9
3. Put together the converted value of each group.So binary number 11101100101001 is 3B29 in hexadecimal.

## Conversion from Hexadecimal to Binary

Conversion can be done by converting each hexadecimal digit to 4 binary digits based on the following table:

0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
A 1010
B 1011
C 1100
D 1101
E 1110
F 1111

Example: 3B29, convert each digit as follows:
3 is converted to 0011
B is converted to 1011
2 is converted to 0010
9 is converted to 1001
So hexadecimal number 3B29 is equivalent to 0011101100101001 in binary.