Table of Contents Link to heading
Binary Numbering Link to heading
All computer data is represented using the binary number system.
Binary is base 2 and works with two digits, 0 and 1.
Binary numbers have some distinct advantages:
- The simplicity of addition and subtraction
- Binary information is easier to process due to having only two states (1 for ‘on’, 1 for ‘off’)
- Less space consumed
Binary numbers are positional and each digit represents 2n, where n, starting from 0, is the position from the right.
Binary to Decimal Link to heading
Positional Notation Link to heading
Since there are 2 digits, each position represents a power of 2.
Position | Binary | Decimal |
---|---|---|
8th | 1 | 27 = 128 |
7th | 1 | 26 = 64 |
6th | 1 | 25 = 0 |
5th | 1 | 24 = 16 |
4th | 1 | 23 = 0 |
3rd | 1 | 22 = 0 |
2nd | 1 | 21 = 2 |
1st | 1 | 20 = 1 |
For example, to convert 110100112 to decimal.
Position | Binary | Decimal |
---|---|---|
8th | 1 | 128 |
7th | 1 | 64 |
6th | 0 | 0 |
5th | 1 | 16 |
4th | 0 | 0 |
3rd | 0 | 0 |
2nd | 1 | 2 |
1st | 1 | 1 |
1101001110 = 1ร27 + 1ร26 + 1ร24 + 1ร21 + 1ร20 = 12810 + 6410 + 1610 + 210 + 110 = 21110
Doubling Link to heading
Take each leftmost value, multiplied by 2 and added to the next value.
110100112
- 0ร2 + 1 = 1
- 1ร2 + 1 = 3
- 3ร2 + 0 = 6
- 6ร2 + 1 = 13
- 13ร2 + 0 = 26
- 26ร2 + 0 = 52
- 52ร2 + 1 = 105
- 105ร2 + 1 = 21110
Decimal to Binary Link to heading
Position | Column Value | Decimal | Compared to Column Value | Resulting Action | Binary |
---|---|---|---|---|---|
8th | 128 | 211 | Less than 256 but more than 128 | Mark a 1 for the 8th column and then subtract 128 from 215 | 1 |
7th | 64 | 87 | More than 64 | Mark a 1 for the 7th column then subtract 64 from 87 | 1 |
6th | 0 | 23 | Less than 32 | Mark a 0 for the 6th column | 0 |
5th | 16 | 23 | More than 16 | Mark a 1 for the 5th column and then subtract 16 from 23 | 1 |
4th | 0 | 7 | Less than 8 | Mark a 0 for the 4th column | 0 |
3rd | 0 | 7 | More than 4 | Mark a 1 for the 3rd column and then subtract 4 from 7 | 1 |
2nd | 2 | 3 | More than 2 | Mark a 1 for the 2nd column and then subtract 2 from 3 | 1 |
1st | 1 | 1 | Equal to 1 | Mark a 1 for the 1st column | 1 |
Binary to Hexadecimal Link to heading
Read at ๐
Hexadecimal to Binary Link to heading
Read at ๐