HOME | WRITEUPS | TOOLS | RESOURCES | TUTORIALS | ABOUT |

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, 10_{2} or 1234_{9}. 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×10^{2}+5×10^{1}+4.

The scientific notation of a number changes when the base changes. The scientific notation of 354_{6} would be 3×6^{2}+5×6^{1}+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.

45

+3D

---

84

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 1010_{2} to base 10.

- First, we write it in scientific notation: 1×2
^{3}+0×2^{2}+1×2^{1}+0. - Then, we simplify: 8 + 2 = 10.

We're done! It's as simple as that! You can also think of it as a table:

Digit | 1 | 0 | 1 | 0 | |

Value | 8 | 4 | 2 | 1 | |

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:

- Divide your number by the base and record the remainder. This is the rightmost digit.
- Divide the answer from the previous division by the base again. This digit goes to the left of the last one.
- Keep dividing and recording the remainders until the number is less than the base. This is the leftmost digit.

Essentially, you're just going to divide by the base and get the remainder. Let's convert 144 to base 5.

- We divide our number by the base: 144 / 5 = 28, remainder 4. ___4
- 28 / 5 = 5, remainder 3. __34
- 5 / 5 = 1, remainder 0. _034
- 1 is less than the base, 5. We use it as the leftmost digit: 1034
- Our completed conversion is 1034
_{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).

- The first digit adds to: D × 16
^{3}= 13 × 4096 = 53248 - The second digit adds to: F × 16
^{2}= 15 × 256 = 3840 - The third digit adds to: A × 1 = 10 × 16 = 160
- The final digit is just 2 × 1 = 2
- Adding them all up, we get 53248 + 3840 + 160 + 2 = 57250

Now let's try converting 119 from decimal to base 3.

- 119 / 3 = 39 R 2
- 39 / 3 = 13 R 0
- 13 / 3 = 4 R 1
- 4 / 3 = 1 R 1
- 1 / 3 = 0 R 1
- Our number is 11102
_{3}

Let's convert 10011100_{2} to base 4 and then to base 16 quickly, using a special trick.

- For this, let's look at a special property of these bases.

Since 4 is a power of 2 and 16 is a power of 4, we can group these up in sections. - For the first part, we will split up 10011100 into groups of 2: 10 01 11 00. We can convert each of these numbers into base 4 individually: 3 1 4 0. Just put these numbers together, 2130
_{4}, and you have converted it to base 4! - For the next part, we spit up 3140 into groups of 2: 21 30. We can convert these to base 16 individually again: 9 C(12). Finally we have our base 16 number, 0x9C.

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 1737_{8} 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.

- Let's do this in scientific notation. 1 × 8
^{3}+ 7 × 8^{2}+ 3 × 8 + 7 = 512 + 7 × 64 + 3 × 8 + 7 = 512 + 448 + 24 + 7 = 991 - Now, to convert to base 27, we need to repeatedly divide by 27:
- 991 / 27 = 36 R 19
- 36 / 27 = 1 R 9
- 1 / 27 = 0 R 1
- Our number is 19_. To write 19 as a single digit, we could either count up for A=10, B=11, and on, or get the 10th letter in the alphabet since 9 + 10 = 19 (work with me please). Since the 10th letter is J, our number is 19J. Weird!

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!