Quickly Convert Binary to Decimal in Your Head

[Update, April 13, 2007: Thanks to Herr Ziffer for catching a confusing typographical error.]

I can’t believe I’d never seen (or figured out) this quick method for converting a binary number to a decimal number in your head. All you need to be able to do is double numbers and occasionally add one.

  1. Start at the first ‘1′ on the left, and start with the mental number one
  2. Move one digit right. If that digit is a zero, multiply your mental number by two. If it is a one, multiply your mental number by two and add one.
  3. Repeat step 2 for every digit of the binary number

Here’s an example. We’ll use the binary number 1101010 1011010:

  • 1011010 – We start at the first one. Our mental total: 1
  • 1011010 – Next digit is a zero; we double our mental number: 1 x 2 = 2.
  • 1011010 – Next digit is a one; we double our mental number and add one: 2 x 2 + 1 = 5
  • 1011010 – Another one; double and add one: 5 x 2 + 1 = 11
  • 1011010 – Zero; double: 11 x 2 = 22
  • 1011010 – One; double and add one: 22 x 2 + 1 = 45
  • 1011010 – And finally a zero; double: 45 x 2 = 90

The rest of this post is a little more technical, so if you glazed over when reading the above, it now may be time to soothe your tired mind.

Discrete finitite automaton to identify binary numbers divisible by threeI happened across this trick while contemplating a three-state discrete finite automaton that identifies binary numbers divisible by three. The automaton starts in state 0, and like the above procedure starts at the left side of the number. The number of the state can be thought of as the remainder of the number as read so far, mod 3. Every time a zero or a one is read, the automaton follows the arrow with that label from its current state. If it ends in state 0, the number is evenly divisible by three. Once I understood why the DFA actually works, the mental calculation became glaringly obvious.

For even more fun, the regular expression (0*(1(01*0)*1)*)* will also match binary numbers divisible by three.

Exciting! Now you have something to talk about the next time you go to a cocktail party.

12 Responses to “Quickly Convert Binary to Decimal in Your Head”


  • You’re very welcome, Santosh. Thanks for reading.

  • Paul,

    You had me scratching my head for ten minutes wondering why I couldn’t do the conversion. It appears you have a typo: “We’ll use the binary number 1101010″ should be “We’ll use the binary number 1011010″.

    With this, I intend to startle my friends and seduce my enemies at the next cocktail party.

    Thanks. :)

  • Aargh! I thought I’d triple-checked everything!

    This is a good warning, though: misapplied, you can also use this trick to embarrass yourself publicly. Thanks, Herr Z.

  • Wow. Thanks. I am studying for CCNA and this just made life a whole lot easier.

  • thank you so much!! Will be very much helpful in my exam which is in 1 day time lol…

  • hey buddy u are simply great. please tell me the trick that how did u calculate the regu;ar expression is there any trick????

  • Hi, Sumitra. Regular expressions and discrete finite automata are equivalent; that is, they both are able to recognize the same class of “languages”. A theory of computation textbook should explain this equivalence in detail (Michael Sipser’s Introduction to the Theory of Computation, for example). There are a lot of lecture slides online that explain the process of converting one to another….http://www.math-cs.gordon.edu/courses/cps220/Notes/regular_expressions.pdf gives a decent overview.

  • AbsolutelyIMPRESSEDByYourmethod

    Do you have any tips on converting Decimal to Hex or binary in head?

    (please notify me via email, if you happen to have a solution)

  • Hi, AIbY,

    This trick can be used in reverse for converting decimal to binary, but it’s harder to do mentally as the binary numbers tend to overflow your mental registers. If you try it, it’s best to use a piece of paper and write the binary number down as you go. You’ll be writing down the digits from right (least significant) to left (most significant).

    So, the procedure looks something like:

    1. Start with the decimal number in your head
    2. Is the current decimal number divisible by 2?
    a. If so, then write down 0
    b. If not, then write down 1 and subtract 1 from the mental number.
    3. Divide your mental number by 2 and go back to step 2. Repeat until your mental number is 0.

    It’s easy to lose track of where you are in the conversion process, so jotting notes is helpful.

    Directly applying this process to hexadecimal is even harder, as it relies on the ease of dividing by two. One possible approach would be to first convert your decimal number to binary as described above and then converting each set of four binary digits to hex, starting from the right…easy enough, just memorize your single-hex-digit-to-binary conversion table.

  • wow its very interesting and amazing this is very useful inspiring me for my education research…thanks Zanoli

  • WOW this is really awesome i have tried the method and its reverse
    thanks Herr Ziffer
    thanks Pual

Leave a Reply