About This Calculator

This calculator gives you a quick and easy way to visualize and convert numbers between hexadecimal, decimal, octal and binary. All fields update in real time. When you edit a number in one numbering system the changes will immediately reflect in all the others. You can also click on the bits to directly clear or set them and observe how the number changes.

31
24
0
0
0
0
0
0
0
0
23
16
0
0
0
0
0
0
0
0
15
8
0
0
0
0
0
0
0
0
7
0
0
0
0
0
0
0
0
0

>> 0

Settings

How Do Base-N Number Systems Work?

Let's think about how we count numbers. We could count to large numbers with only one digit, but we would need a large number of unique symbols to represent those numbers! We could also represent a large number by using tally marks, but we would reach a large number of tally marks very quickly. To solve these problems (and generally make math easier) we count numbers using bases. In base systems each digit in a number represents the number of "full buckets" of the previous digit. In the decimal system we have ten symbols (0-9) per digit. When we want to count higher than 9, we add a 1 to the tens digit, then set the ones digit back to 0 (09->10). The 1 in the tens digit means "we have 1 full bucket of ten". 137 means "we have 1 full bucket of one hundred, plus 3 full buckets of ten, plus 7."

In hexadecimal (base-16) we have 16 symbols. With only one digit we can count from zero to fifteen. The extra digits after 9 are represented by A, B, C, D, E, and F. When we count up to F (15 in decimal) and want to add one more, we add a 1 to the "sixteens" digit and set the F back to 0 (F->10). It's important to note that 10 in hexadecimal is not the same as 10 in decimal. To avoid confusion you'll sometimes see hex notated with '0x' in front, e.g. 0x10 = 16 (decimal). 0x10 means "we have 1 full bucket of sixteen". Likewise, a hex number like 0x3F means "we have 3 full buckets of sixteen, plus F (15) equals 63."

In general, you can convert a number system of base-n (where n is a real positive integer) to base 10 with a0 + (a1 * n^1) + (a2 * n^2) + ..., where a0, a1, a2... are the integers of each digit. 137 (base-10) = (1 * 10^2) + (3 * 10^1) + 7. 0x2AC (base-16) = (2 * 16^2) + (10 * 16^2) + 12 = 684.

Why Bother?

Most humans have ten fingers, so base-10 arose as the most natural counting system for everyday life. However, life for programmers is different, because computers operate with only 1s and 0s. Having only two unique symbols per digit means they must use binary (base-2) for calculations. Hexadecimal (base-16) is a convenient way to represent bytes. A single byte can be represented by two hex digits (0xFF = 0b11111111). Octal isn't as common nowadays, but still carries some use in computing and human life.

How to Count to 1023 on Two Hands

Just because we have 10 fingers, doesn't mean we need to use them like tally marks! Think of your fingers as a 10-bit binary number. A closed or curled finger represents a 0 and an extended finger represents a 1. Closing all your fingers gives you 0. Pointing only your right pinky gives 1. Curling the pinky and pointing the ring finger gives 10b = 2. Extending your pinky again gives you 11b = 3. Curling the pinky and ring and extending the middle finger gives a potentially offensive 100b = 4.

You can point or curl any combination of your finger to get a different number. Pointing your right index, right ring, and right pinky fingers gives 1011b = 11. Pointing your left ring finger, left thumb, right index finger gives 100101000b = 296! And hey, if you are dexterous enough to point and curl individual toes, you could even count up to 1048575! Put those digits to work!