Perhaps a bit tediously technical for here but...Converting Ip Addresses to Binary Code ?

menace-uk-

Starfield Gazer
Sep 11, 2013
37,645
15,639
3,930
Can anybody here explain in a clear and simple manner how to convert IPV4 & IPV6 addresses to Binary code and perhaps back to IP addresses ?
 
This might help:
http://www.csgnetwork.com/ipaddconv.html

Unless you actually care about how it's done rather than just having it done.

Converting to binary isn't that hard and plenty of resources can be found by a quick google search. No point doing it yourself though, plenty of online calculators.
 
Binary conversions are not too bad. They seem bizarre but when you break them down, they're relatively simple.
 
Last edited:
  • Like
Reactions: menace-uk-
Decimal to Binary helps if you break it down into a chart.

Say, the number is 17 and you want the 8-bit binary for it.
Start with this chart, the order has to be right to left.
128 64 32 16 8 4 2 1
8-bit number is what we want, so we start from 1, and keep doubling eight spots, so we end up with 128.
Then you see if the numbers in the chart can fit in the conversion number.
So:
128 can't go into 17, so 0
64 can't either, so 0
32, again, 0

16, can, however, so we put a 1 there.
So we have 16 and our number is 17 for the conversion. So we need one more.
Right now we have 0001. For each instance you put a 1, you're going to include that number in addition.

So, like for right now, we have 16+...

Like I said, we need 1 here, so jump all the way to the last spot.

So, it would be 00010001

It's the 16th spot plus the 1st that gets us to 17.
 
  • Like
Reactions: The Living Tribunal
Decimal to Binary helps if you break it down into a chart.

Say, the number is 17 and you want the 8-bit binary for it.
Start with this chart, the order has to be right to left.
128 64 32 16 8 4 2 1
8-bit number is what we want, so we start from 1, and keep doubling eight spots, so we end up with 128.
Then you see if the numbers in the chart can fit in the conversion number.
So:
128 can't go into 17, so 0
64 can't either, so 0
32, again, 0

16, can, however, so we put a 1 there.
So we have 16 and our number is 17 for the conversion. So we need one more.
Right now we have 0001. For each instance you put a 1, you're going to include that number in addition.

So, like for right now, we have 16+...

Like I said, we need 1 here, so jump all the way to the last spot.

So, it would be 00010001

It's the 16th spot plus the 1st that gets us to 17.

I'm a network engineer by trade. ^^^ Very good way of explaining it.
 
Ok guys/gals, thank you. I think I have it now, both converting from decimal to binary and vice versa :txbsmile:
 
01001010 01110101 01110011 01110100 00100000 01110101 01110011 01100101 00100000 01100001 00100000 01100011 01100001 01101100 01100011 01110101 01101100 01100001 01110100 01101111 01110010 00101110
 
01001010 01110101 01110011 01110100 00100000 01110101 01110011 01100101 00100000 01100001 00100000 01100011 01100001 01101100 01100011 01110101 01101100 01100001 01110100 01101111 01110010 00101110
01001001 00100000 01110011 01100101 01100101 00100000 01110111 01101000 01100001 01110100 00100000 01111001 01101111 01110101 00100000 01100100 01101001 01100100 00100000 01110100 01101000 01100101 01110010 01100101 00101110
 
  • Like
Reactions: Obscene Jester