|
Number System: Binary, Decimal, Hexadecimal
First Privious 1 2 Next Last
Converting Bits From Binary to Decimal
The following table shows how the bits in one octet are converted from binary code to a decimal value.
| Binary code |
Bit values |
Decimal value |
| 00000000 |
0 |
0 |
| 00000001 |
1 |
1 |
| 00000011 |
1+2 |
3 |
| 00000111 |
1+2+4 |
7 |
| 00001111 |
1+2+4+8 |
15 |
| 00011111 |
1+2+4+8+16 |
31 |
| 00111111 |
1+2+4+8+16+32 |
63 |
| 01111111 |
1+2+4+8+16+32+64 |
127 |
| 11111111 |
1+2+4+8+16+32+64+128 |
255 |
Convert the following binary numbers to decimal format.
| Binary value |
Decimal value |
| 10001011 |
139 |
| 10101010 |
170 |
| 10111111 11100000 00000111 10000001 |
191.224.7.129 |
| 01111111 00000000 00000000 00000001 |
127.0.0.1 |
Convert the following decimal values to binary format.
| Decimal value |
Binary value |
| 250 |
11111010 |
| 19 |
00010011 |
| 109.128.255.254 |
01101101 10000000 11111111 11111110 |
| 131.107.2.89 |
10000011 01101011 00000010 01011001 |
Use the calculator (scientific view) in the Accessories group to convert decimal format to binary format, and vice versa.
Hexadecimal
The other major numbering system used by computers is hexadecimal, or Base 16. In this system, the numbers are counted from 0 to 9, then letters A to F before adding another digit. The letter A through F represent decimal numbers 10 through 15, respectively. The below chart indicates the values of the hexadecimal position compared to 16 raised to a power and decimal values. It is much easier to work with large numbers using hexadecimal values than decimal.
To convert a value from hexadecimal to binary, you merely translate each hexadecimal digit into its 4-bit binary equivalent. Hexadecimal numbers have either and 0x prefix or an h suffix. For example, the hexadecimal number: 0x3F7A
Translates into, Using the Binary chart and the below chart for Hex:
0011 1111 0111 1010
| Decimal |
Hexadecimal |
Binary |
| 0 |
0 |
0000 |
| 1 |
1 |
0001 |
| 2 |
2 |
0010 |
| 3 |
3 |
0011 |
| 4 |
4 |
0100 |
| 5 |
5 |
0101 |
| 6 |
6 |
0110 |
| 7 |
7 |
0111 |
| 8 |
8 |
1000 |
| 9 |
9 |
1001 |
| 10 |
A |
1010 |
| 11 |
B |
1011 |
| 12 |
C |
1100 |
| 13 |
D |
1101 |
| 14 |
E |
1110 |
| 15 |
F |
1111 |
First Privious 1 2 Next Last
|