When counting, we use the digits 0 to 9, and once those are used up, we add a decimal place and start back up at 0. But what if we only used 4 digits, 0 to 3? Or what if we added a digit, A? By doing so, we would be changing the base of the number system.
Most of the numbers we see are in base 10, which uses the digits 0 to 9. A few other common bases are binary (base 2) which uses 0 and 1, and hexadecimal (base 16) which uses 0 to 9 and A to F.
NOTE: The digit A represents 10, the digit B represents 11, and so on.
Bases are represented with a subscript after the number representing the base. For example, 102 or 12349. Any numbers without this subscript are assumed to be base 10.
Scientific Notation is very useful with number bases. As a reminder, scientific notation of a number like 354 would be 3×102+5×101+4.
The scientific notation of a number changes when the base changes. The scientific notation of 3546 would be 3×62+5×61+4.
An important thing to note, each digit in a number has to be less than its base. 5 can't be a digit in base 4, and 7 can't be a digit in base 7.
Now on to adding numbers of a different base. Essentially, this is the same as adding in base 10. Let's do an example in hexadecimal.
The 5 and D add to 12. (E, F, 10, 11, 12) The units digit is 2. Then we add 4 + 3 + 1 = 8. Our tens digit is 8. Our answer is 0x82.
NOTE: Hexadecimal numbers start with 0x and then the number, rather than the 16 subscript.
We can start with converting numbers from any base to base 10. This is very simple, just write it in scientific notation, and simplify.
Let's say we want to convert 10102 to base 10.
We're done! It's as simple as that! You can also think of it as a table:
|Sum||8 +||0 +||2 +||0||= 10|
Converting to another base will be a bit more difficult, though. There are a few steps to go through:
Essentially, you're just going to divide by the base and get the remainder. Let's convert 144 to base 5.
Notice how since these are all remainders of the base, all the numbers must be less!
First, let's convert 0xDFA2 from hexadecimal (base 16) to decimal (base 10).
Now let's try converting 119 from decimal to base 3.
Let's convert 100111002 to base 4 and then to base 16 quickly, using a special trick.
2 digits, such as 10, in binary can range from 0-3, just like 1 digit in base 4. 2 digits in base 4 can range from 0-15, just like 1 digit in base 16. This new strategy allows us to only have to deal with small numbers. It works for all powers. 2 digits in base 3 is 1 digit in base 9, and 3 digits in base 3 is 1 digit in base 27.
As a final challenge, let's convert 17378 from base 8 to base 29.
We'll need to divide this into 2 parts, converting from base 8 to base 10, then from base 10 to base 29.
Changing bases is very tedious work, especially with large numbers. There's a lot of times where you want to change a number's base fast. That's why we've created a base converter. It can change any number from one base to another.
Simply enter the number in one base (make sure each of the digits are valid) and enter it's base in the start base spot. Then, enter the base you want to convert it to in the end base spot. It's a helpful tool for large numbers and quick conversions!