Mathematics
Convert Base 10 (Decimal) to Any Base
Divide the base 10 number by the target base.
Record the remainder.
Continue dividing the quotient by the target base until the quotient becomes 0.
The remainders, read from bottom to top, give the number in the new base.
Example 1: Convert 123 (10) to Base 8 (Octal)
Divide 123 by 8 = 15 remainder 3
Divide 15 by 8 = 1 remainder 7
Divide 1 by 8 = 0 remainder 1
Answer is 173 (8)
To get remainder, Remainder = 123 - (8 x 15) = 123 - 120 = 3
Converting Any Base to Base 10
You can use this method for any number in any base (like base 2, base 8, base 16, etc...) to convert it to its equivalent decimal (base 10) value.
Example 1: Converting Binary to Decimal
For the binary number 1011(2)
:
Then multiply:
1 x 2^3 = 8
0 x 2^2 = 0
1 x 2^1 = 2
1 x 2^0 = 1
Then sum them up 8 + 0 + 2 + 1 = 11 (10)
Example 2: Converting Hexadecimal to Decimal
For the hexadecimal number A7(16):
A7(16):
Then multiply:
A = 10
, so10 x 16^1 = 160
7 x 16^0 = 7
Then sum them up 160 + 7 = 167 (10)
Converting Decimal (Base 10) Float to Any Base:
Convert the integer part as usual by dividing by the base.
Convert the decimal part by multiplying by the base, taking the integer, and repeating for the remainder.
Example: Convert 123.625 (10) to Base 8:
Integer part: 123 → 173 (base 8)
Decimal part: 0.625 × 8 = 5
Answer: 173.5 (base 8)
Converting Any Base Float to Decimal (Base 10):
Integer part: Multiply digits by powers of the base.
Decimal part: Multiply digits by negative powers of the base.
Example: Convert 1011.101 (2) to Decimal:
Integer: 1011 → 11 (base 10)
Decimal: 0.101 → 0.625
Answer: 11.625 (base 10)
That's it! Simple steps for both directions.
Last updated