If you’re in a technical computer field you should know your binary and hex. Many don’t and they’re secretly ashamed. Others mostly know (or at least they used to) and they have to re-remember the rules whenever they need to use it or explain it to others.

Let’s fix this right now.

The following system will apply to binary, octal, decimal, or hex (as well as any other base). Whenever you need to translate something to decimal (the most common task), simply perform the following steps and you’ll peg it every time.

Starting on the right of the number you’re converting, get the decimal value of that character/number and multiply it by the base (2,8,16) to the power of the exponent of the place you’re on (starting with 0 on the right).

So if your hex number is 3AF, the ‘F’ is 15 times 160, the ‘A’ is 10 times 161, and the ‘3’ is 3 times 162.

Or, in English:

Value times base to the exponent (VBE).

Just remember “VBE” and you’re set.

An even faster way is to just multiply the base by the exponent first, so if you’re in the third position from the right, and you’re doing hex, then you’re at 162, which is 256, and then multiply that by your value.

So if your value is A, that’s a 10, so it’s 10 X 256. Super simple.

Just remember VBE, but do the base x exponent piece first.

If you want/need to visualize this better, try writing it down.

On the first line write down the base of the number system you’re converting, e.g. 2 for binary, 16 for hex, etc. We’ll call this the base On the line below, write out the total range of values available, e.g. 1-2 for binary, 0123456789ABCDEF for hex, etc. We’ll call this the symbol. On the next line, under each symbol, put the decimal equivalent of that symbol, e.g. A=10, F=15, etc. We’ll call that the decimal. Below that, write out the number you’re trying to convert, e.g. 3CAF (hex). We’ll call that the value. Under each value, starting from the rightmost place, label each place starting with zero (0). We’ll call that the exponent. Start from the right and look up the value on your symbols line. Find the associated decimal for it. Multiply the decimal number with the base to the power of the exponent. Do this for each character you’re converting as you move to the left and add up the results.

That means we start from the right and take the F value. Look that up on the symbol chart to find the decimal, which is 15. Multiply that by the base (16) to the power of the exponent (0) to get: 15 x 160. Anything to the power of zero is 1, so it’s 15×1, or 15.

For the second value from the right (A), we do the same. Look it up to get the decimal value (10). Multiply that by the base (16) to the power of the exponent (1). So, 16 times 1 is 16, meaning we’re doing 10 times 16, or 160.

For the third value from the right (C), look it up to get the decimal value (12). Multiply that by the base (16) to the power of the exponent (2). So, 16 to the power of 2 is 256, and that’s multiplied by 12 for 3072.

For the final value from the right (3) it’s decimal value is still 3. Just multiply that by the base (16) to the power of the exponent (3). So, 16 to the power of 3 is 4096, and that times three is 12,288.

Now add those all up and you get 15+160+3072+12288, which equals 15,535.

So the formula for each character/number in the value is:

value x base exponent

…and then you just add those all up and that’s your result.

The way this all works is that we’re combining larger and larger ranges into the character sets themselves (1-2 for binary, A-F for hex, etc.) which allows for a higher value to start with (a two max with binary vs. a 15 max with hex). Then you multiply that by your base to the exponent of what place you’re on (rightmost, second from the right, etc.).

As you add more and more places (like with a 6-digit hex number) the combination of the range (0-15) being multiplied by the baseexponent (166) produces really high numbers. The advantage is that when you use a number system with a higher base (radix) you can store much higher values into far fewer characters.

As an example, let’s say we only have two places to store a number. If we use binary we can only store a maximum value of 3. If we use decimal we can only store a maximum value of 99. But if we use hex we can store a maximum value of 255. Take that to four places and now the values are 15, 9,999, and 65,535 respectively.

::

Notes

1 Here is a really full-bodied explanation for those who need more depth.