Decimal to Binary converter and CALCULATOR


To
Enter Decimal number:
2

2

Binary,Decimal & Hexadecimal CALCULATOR

Expression Type

2

2

Number Systems

Computers use binary numbers internally, because computers are made naturally to store and process 0s and 1s. The binary number system has two digits, 0 and 1. A number or character is stored as a sequence of 0s and 1s. Each 0 or 1 is called a bit (binary digit).

In our daily life we use decimal numbers. When we write a number such as 20 in a program, it is assumed to be a decimal number. Internally, computer software is used to convert decimal numbers into binary numbers, and vice versa.

We write computer programs using decimal numbers. However, to deal with an operating system, we need to reach down to the "machine level" by using binary numbers. Binary numbers tend to be very long and cumbersome. Often hexadecimal numbers are used to abbreviate them, with each hexadecimal digit representing four binary digits. The hexadecimal number system has 16 digits: 0-9 and A-F. The letters A, B, C, D, E, and F correspond to the decimal numbers 10, 11, 12, 13, 14, and 15.

The digits in the decimal number system are 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. A decimal number is represented by a sequence of one or more of these digits. The value that each digit represents depends on its position, which denotes an integral power of 10. For example, the digits 7, 4, 2, and 3 in decimal number 7423 represent 7000, 400, 20, and 3, respectively, as shown below:

7423 = 7 × 103 + 4 × 102 + 2 × 101 + 3 × 100

103 102 101 100 = 7000 + 400 + 20 + 3 = 7423

The decimal number system has ten digits, and the position values are integral powers of 10. We say that 10 is the base or radix of the decimal number system. Similarly, since the binary number system has two digits, its base is 2, and since the hex number system has 16 digits, its base is 16.

If 1101 is a binary number, the digits 1, 1, 0, and 1 represent 1 × 23, 1 × 22, 0 × 21, and 1 × 20,respectively:

1101 = 1 × 23 + 1 × 22 + 0 × 21 + 1 × 20

23   22   21   20   = 8 + 4 + 0 + 1 = 13

If 7423 is a hex number, the digits 7, 4, 2, and 3 represent 7 × 163, 4 × 162, 2 × 161, and 3 × 160,respectively:

7423 = 7 × 163 + 4 × 162 + 2 × 161 + 3 × 160

163 162 161 160 = 7000 + 400 + 20 + 3 = 7423

Conversions Between Binary and Decimal Numbers

Given a binary number bnbn - 1bn - 2...b2b1b0, the equivalent decimal value is bn × 2n + bn-1 × 2n-1 + bn-2 × 2n-2 + ... + b2 × 22 + b1 × 21 + b0 × 20.

Here are some examples of converting binary numbers to decimals:

  1. Binary: 10
    Conversion Formula: 1 × 21 + 0 × 20
    Decimal: 2
  2. Binary: 1000
    Conversion Formula: 1 × 23 + 0 × 22 + 0 × 21 + 0 × 20
    Decimal: 8
  3. Binary: 10101011
    Conversion Formula: 1 × 27 + 0 × 26 + 1 × 25 + 0 × 24 + 1 × 23 + 0 × 22 + 1 × 21 + 1 × 20
    Decimal: 171

To convert a decimal number d to a binary number is to find the bits bnbn - 1bn - 2...b2b1b0 such that

d = bn × 2n + bn-1 × 2n-1 + bn-2 × 2n-2 + ... + b2 × 22 + b1 × 21 + b0 × 20

These bits can be found by successively dividing d by 2 until the quotient is 0. The remainders are b0b1b2...bn - 2bn - 1bn.

For example, the decimal number 123 is 1111011 in binary. The conversion is done as follows:

2 123
2 61 1
2 30 1
2 15 0
2 7 1
2 3 1
1 1

Than count Binary number bottom to Up. 1111011

Conversions Between Hexadecimal and Decimal Numbers

Given a hexadecimal number hnhn - 1hn - 2...h2h1h0, the equivalent decimal value is hn × 16n + hn-1 × 16n-1 + hn-2 × 16n-2 + ... + h2 × 162 + h1 × 161 + h0 × 160.

Here are some examples of converting hexadecimal numbers to decimals:

  1. Hexadecimal: 7F
    Conversion Formula: 7 × 161 + 15 × 160
    Decimal: 127
  2. Hexadecimal: FFFF
    Conversion Formula: 15 × 163 + 15 × 162 + 15 × 161 + 15 × 160
    Decimal: 65535
  3. Hexadecimal: 431
    Conversion Formula: 4 × 162 + 3 × 161 + 1 × 160
    Decimal: 1073

To convert a decimal number d to a hexadecimal number is to find the bits hnhn - 1hn - 2...h2h1h0 such that

d = hn × 16n + hn-1 × 16n-1 + hn-2 × 16n-2 + ... + h2 × 162 + h1 × 161 + h0 × 160

These bits can be found by successively dividing d by 16 until the quotient is 0. The remainders are h0h1h2...hn - 2hn - 1hn.

For example, the decimal number 123 is 7B in hexadecimal. The conversion is done as follows:

16 123
16 7 11
0 7

Than count Hexadecimal number bottom to Up. 7B

Conversions Between Binary and Hexadecimal Numbers

To convert a hexadecimal to a binary number, simply convert each digit in the hexadecimal number into a four-digit binary number, using Table

Hexadecimal Binary Decimal
0 0000 0
1 0001 1
2 0010 2
3 0011 3
4 0100 4
5 0101 5
6 0110 6
7 0111 7
8 1000 8
9 1001 9
A 1010 10
B 1011 11
C 1100 12
D 1101 13
E 1110 14
F 1111 15

For example, the hexadecimal number 7B is 1111011, where 7 is 111 in binary, and B is 1011 in binary.

To convert a binary number to a hexadecimal, convert every four binary digits from right to left in the binary number into a hexadecimal number.

For example, the binary number 1110001101 is 38D, since 1101 is D, 1000 is 8, and 11 is 3.