Decimal-to-Hex-to-Decimal Calculator

On the right you have a decimal-to-hex calculator widget as well as a hex-to-decimal calculator widget. Read on if you would like to see a tutorial on how decimal and hex work

Quick and easy hexadecimal tutorial

(Don't be scared.)

Imagine that your dollar system only had dollar amounts in powers of 10. So, the only bills it has is $1 = $100, $10 = $101, $100 = $102, and even bigger bills like $1000 = $103 and $10000 = $104. Notice that the number of zeros at the end of the dolar bill is the same as the exponent on the power of 10.

Now suppose that you want to put $1073 in your pocket, and you want to use as few bills as possible. Well, then you want to use the biggest bills possible. So you use 1×$1000 bill, 0×$100 bill, 7&times$10 bills, and 3&times$10 bill.

Notice that the number of bills of each size corresponds exactly to the digits in the money you want. $1073 (ONE ZERO SEVEN THREE) is the same thing as ONE $1000 bill, ZERO $100 bills, SEVEN $10 bills, and THREE $1 bills.

Now suppose you took your $1073 to a whole different country, where their $1 is worth just as much as ours. The difference is, everyone in this country was born with sixteen fingers. (Follow me here.) Because of that, their whole number system, and their whole dollar system uses powers of 16 instead of powers of 10. They even use a different dollar symbol, ¤ instead of $. This is weird to us, but completely normal to them. In fact, they make fun of our crossed-out "S" dollar symbol and tiny ten-finger arms.

When you go exchange money in this country, you are going to exchange each $16 for their ¤10. Notice, however, that ¤10 doesn't mean "ten dollars", it means "sixteen" dollars. They just use a funny number system where that digit "1" in the ¤10 represents 16.

So how much of each bill are you going to get when you go to exchange your $1073 into their funky base-16 bills? Well, you can stack your wallet with 1073 ¤1 bills, or you can go like you did before and use as few bills as possible. Pull out your calculator and calculate powers of 16. You can get 4×¤100 bills (totalling ¤400 or $1024), 3×¤10 bills (totalling ¤30 or $48), and 1×¤1 bills (totalling ¤1 or 1). Add up the numbers and you find ¤431 = $1024 + $48 + $1 = $1073.

Now anyone who uses hex knows that hex numbers frequently contain the letters a through f. For example, 3a2 in hex is equivalent to 930 in decimal. That is, ¤3a2 = $930. Why use all those letters?

The answer to that question is actually as simple and logical as that you need one single symbol to represent each number below your standard base. For example, we use base 10, so we need a symbol to represent all the numbers from zero through nine. Those symbols, of course, are 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. Hexadecimal base uses those same symbols for the numbers zero through nine, but it needs additional symbols to represent the numbers ten through fifteen. Why use letters? Because we are already familiar not just with the letters, but what order they go in. a = 10, b = 11, c = 12, d = 13, e = 14, and f = 15.

AddressMunger.com

Juan Rodriguez is a part-time web designer and full time math teacher, and is a Math for America Early Career Fellow. You can contact him here or in the comments below. Over the past eight years, Juan has provided anti-spam and web design tools to over 1000 web-based businesses.