Decimal to basen:
Find the largest power of n smaller than the number. Subtract until the number is less than that. Put the number of times you subtracted into the proper place in the
structure Leaderz0rz described.
Example: 213 decimal to base 5
5^3 = 125
213 - 125 = 88 So far, we have 1000
5^2 = 25
88 - 25 = 63 - 25 = 38 - 25 = 13 Now, we have 1300
5^1 = 5
13 - 5 = 8 - 5 = 3 Now, we have 1320
Now just put the remainder in the last column, for a result of 1323 base5
Basen to decimal:
this is easy. Start at the rightmost digit, this is ones. Now, the one to the left is n's. The one to the left of this is n^2's. etc.
Special note: The numbers above 9, in powers above 10, are replaced with letters. Therefore, A=10, B=11, C=12, etc.
Example: A356 in base 11, to decimal
leftmost: 6. This is 1's. So we have decimal 6
next digit: 5. This is 11^1 = 11's. So we have 6 + 5*11 = 61
next digit: 3. This is 11^2 = 121's. Now we have 61 + 3*121 = 424
last digit: A (10). This is 11^3 = 1331's. So we get 424 + 10*1331 = 13734 decimal
Now, there are also several shortcuts for certain conversions, which I will outline below.
Decimal -> binary shortcut
Take the decimal number at the top of your page. Divide by two, keeping the integer result below it and the remainder beside it. Keep going down the page until you get to 0. Now the binary number is simply the remainders, taken in order from bottom to top.
Example: decimal 235 to binary
235
117 remainder 1
58 remainder 1
29 remainder 0
14 remainder 1
7 remainder 0
3 remainder 1
1 remainder 1
0 remainder 1
And the final result is the remainders taken in bottom-to-top order, which yields 11101011
Binary -> octal shortcut
1110010101101010 <- random binary number produced by hitting the 1 and 0 keys at random
Octal conversion:
1 / 110 / 010 / 101 / 101 / 010 <- the same number divided into groups of three. Now convert each group of three into its equivalent.
1 -> 1
110 -> 6
010 -> 2
101 -> 5
010 -> 2
Therefore, octal = 16252
binary-> hexadecimal (base 16) shortcut
basically the same thing, only divide into groups of four instead.
1110 / 0101 / 0110 / 1010
1110 -> 14 = E
0101 -> 5
0110 -> 6
1010 -> 10 = A
Therefore, hex = E56A
octal or hex-> binary.
This is really easy. Just take the digits and turn them back into groups of three or four binary digits. (remember, those leading zeros are important. Don't take them out except on the very leftmost digit :p)
Also, once you've mastered the shortcuts above, converting from octal to hexadecimal is easier if you don't try to go back to decimal, but rather go back to binary instead.
Hope that rather long-winded post helped things.