Number Systems

Binary, Decimal, Hex

Binary

Decimal

Hex

0000

0

0

0001

1

1

0010

2

2

0011

3

3

0100

4

4

0101

5

5

0110

6

6

0111

7

7

1000

8

8

1001

9

9

1010

10

A

1011

11

B

1100

12

C

1101

13

D

1110

14

E

1111

15

F

Decimal To Binary

Considering Binary is Base 2, all decimals need to be divided by 2 to convert it to binary. By doing that you get the quotient. You continue to repeat that process with each quotient until you get a quotient of 0. Then each of the remainders for each process are combined to equal the binary sum. Ex:

Decimal to Convert = 55 55 / 2 = 27 :: Remainder 1 27 / 2 = 13 :: Remainder 1 13 / 2 = 06 :: Remainder 1 06 / 2 = 03 :: Remainder 0 03 / 2 = 01 :: Remainder 1 01 / 2 = 00 :: Remainder 1 Binary Output = 110111

Binary To Decimal

To convert binary to decimal you'll be multiply the position of each number by 2. So for example the first column would be 2^5*1 = 32. Do this for each position then add the results. Which will equal 55.

1

1

0

1

1

1

2^5

2^4

2^3

2^2

2^1

2^0

Hexadecimal to Binary

This conversion is relatively simple. Just map the Hexadecimal number to the Binary operator and combine. Lets take 12C as an example.

1

2

C

0001

0010

1100

We can trim the zeroes before the 0001, and by combining it with the rest we get 100101100 Which is the equivalent to our 12C Hexadecimal.

Binary to Hexadecimal

The process is almost as simple as the reverse. Take 1111101. First we will consider a block of 4 bytes as an individual binary operand, and we'll be reading this from Right->Left so we get 0111, and 1101. All we have to do is compare that to their hexadecimal chart and we get 7D. Easy.

Decimal To Hexadecimal

Very similar to the Decimal to Binary conversion we'll be divding the decimal by 16 considering Hexadecimal is Base16. Then we'll use the same remainder trick:

Decimal = 55 55 / 16 = 3 :: Remainder 7 3 / 16 = 0 :: Remainder 3 Hexadecimal = 73

Hexadecimal to Decimal

This is the same process as converting Binary to Decimal except we're using 16.

1

2

3

16^2

16^1

16^0

After multiplying, and adding the sum of each you'll get 300.

Last updated