Picture of How to Convert Between base-10, Hexadecimal, and Binary
There are 10 types of people in this world: Those who can read binary and those who can't.

Many electronic and microcontroller projects require the use of a particular base numbering system, such as BCD on thumbwheel switches, hexadecimal (base-16) on hex encoders, and binary in shift registers and dip switches.  Often it is necessary to convert between bases, for example, when using a decade counter and converting a BCD value of a switch into a base-10 (that is, decimal) value that can be easily displayed.  In particular, all math is done in binary in digital systems, as well as at the analog/digital interface (like when you sample a waveform or measure a voltage) using only two digits: 1 and 0.

This is a brief instructable on what numbers represent and how to convert between the bases in which they are represented. This was included in one of my other guides when I realized that it should be separated out and put into its own instructable. After reading this guide you should be able to look at a binary number like "11101011" and tell that it represents the number 235 or convert the hex value "0xC0E4" to its binary equivalent of "1100000011100100" and decimal representation of 19980 without the use of a calculator (unless you suck apples at addition,subtraction,or division, in which case I feel your pain and wholly suggest keeping your favorite calculator handy).

However, no heavy math is needed and you won't need to do anything outside of basic math so don't sweat it if you're mathematically challenged.  This is part of the fun side of math.
ZoranH2 months ago

And here you can find the formal math to convert number in any base to any other base: http://www.codinghelmet.com/?path=exercises/converting-number-bases

nevdull (author)  ZoranH1 month ago


Thanks for that link. Webpages that make use of latex math please me. :)

zack.gibbs.966 months ago

Alright, my question is about decimal to hexadecimal. When you have the number (9 in your example) and divide it by 16 and it equals 0, it works fine. But when you have a number like 429dec, which provides 26, which divides by 16 to 1, what do you do. I tried multiplying the equation by 1 and moving it over, and the converter showed a different result.

nevdull (author)  zack.gibbs.961 month ago
Hi Zack, Ok, if I understand what you're unsure about, let's take the number you gave and work it out using my method.

42910 = ???16 

1. 429 / 16 = 26.8125; .8125*16 = 13; 13 in hex is D. So 0x??D
2. 26 / 16 = 1.625; 0.625 * 16 = 10; 10 in hex is A. So 0x?AD
3. 1 / 16 = 0.0625; 0.0625 * 16 = 1; 1 is 1 in hex, so 0x1AD.
429(dec) = 0x1AD(hex)

Hope that helped to clear it up. If you still have problems feel free to ask again.
Cheers and thanks for the comments!
nevdull (author) 11 months ago

Hey guys,

Thanks for the comments. I checked and it looks like a typo as I have it correctly typed in the preceding line. The typo below is now corrected.

Thanks for finding that!

TheW111 months ago

158 base 10 should be equal to 314 in base 7.

GunnarC TheW111 months ago

I second/confirm/approve of or whatever this statement.

dunsin1 year ago

Good Job. Please confirm the conversion of 158 (Base 10) into base7 the result it should give is 314 (Base 7), not 214 (Base 7).

Just cross-check if there were any errors during calculations.

Weldone !!!

westfw4 years ago

You left out octal (base 8), which is just like base 10. If you're missing two fingers.

nevdull (author)  westfw4 years ago
Oops, where did I leave out octal?

Ah, Tom Lehrer....
westfw nevdull4 years ago
oops. I guess not. It was just missing from titles...
matstermind4 years ago
where did you hear that joke from?
nevdull (author)  matstermind4 years ago
I think I saw it first on a thinkgeek t-shirt.