Arrow

Convert an IP address to binary

First published on August 9, 2006

When I was learning the basics about computer networks, the Internet, etc., the concept of binary numbers was an essential building block in understanding concepts such as subnet masks and other nerdy stuff (admittedly, I don’t actually remember how subnet masks work, but that’s beside the point). IP addresses look something like this: 192.168.0.1 but are actually represented by a number such as this: 11000000.10101000.00000000.00000001.

How the heck do they come up with that? Well, each binary string in an IP address has 8 numbers, which we will call “slots”. Slots are read from right to left. A “1″ means that the slot is “open” or “on” and a “0″ means that the slot is “closed” or “off”. 11111111 means that every slot is open. From right to left, the first slot’s value is 1, and each successive slot’s value is double the previous one (128, 64, 32, 16, 8, 4, 2, 1). To calculate the value of binary string, add up each open slot’s value.

00001100 represents the number 12. Why? The third slot (from the right) is open (because it has a 1) and has a value of 4. The fourth slot is open and has a value of 8. By adding up the value of all open slots, you arrive at 12.

Using only 0′s and 1′s, a set of 8 slots can represent every number between 0 and 255. Each number in an IP address can only be between 0 and 255.

Here’s a calculator to check whether you know how to convert normal IP addresses to binary numbers.

Arrow

28 Responses to “Convert an IP address to binary”


  1. Chris says:

    Thank you so so much for posting this! I am doing a networks module at university and have an exam and never understood how to do it. This is so clear! ou’ve saved my life!!


  2. Frank says:

    Nice one mate, that’s a great help.


  3. russ says:

    LEGEND thanks in class went way over my head but makes sense here


  4. Dan says:

    This has been a massive help. Why dont they teach you this as simple as this in college. Thanks again


  5. Mutaz says:

    Thank you .. you made it easy


  6. kEvone says:

    Thanks a lot for the information. I would have been nice to understand the (128, 64, 32, 16, 8, 4, 2, 1) places for IP addresses in my lecture. I didn’t realize that only converting the decimal numbers to binary wouldn’t cut it. Very nice!


  7. .mod. says:

    Woo hoo ip is busted thank you :) .


  8. Wiremonkey says:

    Good review. I remember my cisco networking teacher trying to explain all this to us and it was way over my head at the time. The way you explained it broke it down pretty well. Cheers!


  9. Stanley Ratnadoss says:

    Thank you so much for your useful and really simple clear cut way of explaining..Even a fool like me could understand it.Thanks buddy..Keep up ur good work..It really helped me to regain what i had forgotten ..Thanks again


  10. Nigel says:

    This was the best help ever thank you for allowing access to this great idea. It really helped cause i totally forgot how to convert to binary. Thanks again


  11. Darko says:

    Fala MNOGU NAJDOBAR SI!!!
    You are the best!


  12. Bill says:

    Thanks for the help I am going through the 270 and this helped me put it just over the top .When I get to my mcse/mcsa course I will be back searching for more .
    Thanks Bill


  13. Shaun says:

    OK something very strange… I found this via a type… and now It got my brain wondering… Ping 10.0.0.09 and it replies with 10.0.0.9 but if you try with 10.0.0.011 then it replies with 10.0.0.8… So Still looking and nothing can explain this to me now… Please if someone can help let me know…

    Thanks


  14. Habib Ullah Bahar says:

    @Shaun: Its becoz when you typed 10.0.0.011, ping program accept the Right most portion as Octate, ie in base-8 format.

    In base-8 format, 011 is equivalent to Decimal 8, so 10.0.011 becomes 10.0.0.8 in decimal.


  15. Abhishek says:

    Can we open websites using this binary Ip Address?

    for ex :
    can we open google.com (IP : 64.233.169.106) using its binary 01000000.11101001.10101001.01101010

    I tried but its not working. I tried by typing http://01000000.11101001.10101001.01101010/ in the browsers address bar


  16. .dll says:

    I do not think that that would work because the network routers are configured to handle TCP/IP packets and they use IPv4 addresses as the source and destination.


  17. Aether says:

    http://0x4A7D2769/

    that’s google, in hex :)


  18. Dan says:

    Awesome explanation. I just got done reading about how to do conversions in my class book and was a bit confused by it. Did a google search for a calculator, ended up here and now am able to do them without the calculator.


  19. Margaret says:

    Great explanation. I was doing this in a class and the book did not clearly explain it. Reading your blog I understood within a few minutes. thanks


  20. tjuno says:

    Thanx alot..i hav an exam in a few hours,this cleared i whole lot..


  21. Sumit says:

    Thanks ! can you provide the logic to check the valid IP in Binary Format.


  22. nik says:

    you can convert ip addys to binary with the scientific calculator on windows. You can even convert to hex and octal but i dont know why you would need to.


  23. jon-edc says:

    damn I’m in a new horizons network + course got books and everything and they couldn’t come close to simplifying this. Thanks a MIl!


  24. Ryan says:

    I found this very useful. I found most books complicate it. Helped me figure it out.


  25. Moose says:

    i guess hex can be useful, if youre really bored you can ping crap in hex… and if youre REALLY bored you could convert it all to hex yourself. i see all the different numbering systems as just multiplying each character by the power of the base that it requires. so with base 2 its simply powers of 2 (128,64,32,16,8,4,2,1) where hexadecimal is powers of 16 (16^4,16^3,16^2,16^1,16^0) as well as octal (probably a more worthless number system) (8^4,8^3,8^2,8^1,8^0). its all just a matter of taking what you know about how the decimal system works (10^4,10^3,10^2,10^1,10^0) and applying the same rule to a new system, in this way you can pick up any new numbering system you need, as well as make up your own for practice.


  26. Chris says:

    I’m bored sitting in the library and remember i didn’t do good on this portion on the test. To understand it I looked it up and totally understand it now, took only a couple minutes. Great help, thanks a bunch!


  27. Rod says:

    Well done this is the best explanation I ever had on the matter I do intend to prepare for the CCNA and the understanding of the conversion of an ip address into binary was a daunting task. Now it is crystal clear once again thank you very much.


  28. Mystie says:

    wow! wow! wow! thanks alot!!!! i have been strugling with this! you make it so simple. What’s wrong with theses teachers! why can’t they use the "kiss" system. thanks

Speak your mind

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word