Number systems
- Binary number system (Radix-2): 0 and 1
- Octal number system (Radix-8): 0 to 7
- Decimal number system (Radix-10): 0 to 9
- Hexadecimal (Hex) number system (Radix-16): 0 to 9, A to F
Decimal to other base
- Divide the decimal number by the value of new base
- Get the remainder from step 1 as the rightmost (least significant) digit of the new base
- Divide the quotient of the previous by the new base
- Get the remainder from step 3 as the next digit Repeat step 3 and 4 until the quotient becomes zero
Example
Convert from decimal to binary: Decimal number: 29
Step | Operation | Result | Remainder |
---|---|---|---|
Step 1 | 29 / 2 | 14 | 1 |
Step 2 | 14 / 2 | 7 | 0 |
Step 3 | 7 / 2 | 3 | 1 |
Step 4 | 3 / 2 | 1 | 1 |
Step 5 | 1 / 2 | 0 | 1 |
The resulting binary is 11101
Other base to decimal
- Determine the column (positional) value of each digit
- Multiply the column value by the digits in the corresponding columns
- Sum the products calculated in step 2
Example
Convert the binary number to decimal: Binary number: 11101
Step | Decimal Number |
---|---|
Step 1 | ((1 × 24) + (1 × 23) + (1 × 22) + (0 × 21) + (1 × 20)) |
Step 2 | 16 + 8 + 4 + 0 + 1 |
Step 3 | 29 |
The resulting decimal is 29
Other base to non-decimal
- Convert the original number to decimal number
- Convert the decimal number obtained to new base number
Shortcut - Binary to octal
- Split binary digits into group of three (start from the right)
- Convert each group of three binary digits to one octal digit
Example
Convert the binary number to octal: Binary number: 10101
Step | Binary Number | Octal Number |
---|---|---|
Step 1 | 10101 | 010 101 |
Step 2 | 10101 | 2 5 |
Step 3 | 10101 | 25 |
The resulting octal is 25
Shortcut - Octal to binary
- Convert each octal digit to three binary number (you may treat octal as binary here)
- Combine all resulting binary groups into a single binary number
Example
Convert the octal to binary: Octal number: 25
Step | Octal Number | Binary Number |
---|---|---|
Step 1 | 25 | 2 5 |
Step 2 | 25 | 010 101 |
Step 3 | 25 | 010101 |
The resulting binary is 010101
Shortcut - Binary to hex
- Split binary digits into groups of four (start from the right)
- Convert each group to one hex symbol (you may treat them as decimal)
Example
Convert the binary to hexadecimal: Binary number: 10101
Step | Binary Number | Hexadecimal Number |
---|---|---|
Step 1 | 10101 | 0001 0101 |
Step 2 | 10101 | 1 5 |
Step 3 | 10101 | 15 |
The resulting hex is 15
Shortcut - Hex to binary
- Convert each hex symbol to a four-digit binary (you may treat hex as decimal here)
- Combine all resulting binary groups into a single binary digit
Example
Convert the hex to binary: Hexadecimal number: 15
Step | Hexadecimal Number | Binary Number |
---|---|---|
Step 1 | 15 | 1 5 |
Step 2 | 15 | 0001 0101 |
Step 3 | 15 | 00010101 |
The resulting binary is 00010101
Operating_system INFO1112 Data_representation Number_system_conversion Binary Hex Hexadecimal