Xerobit

IP to Binary Converter and Binary to IP Calculator

This ip to binary converter turns an IPv4 or IPv6 address into binary, or 32 or 128 bits back into an address, and detects the direction for you. It runs in your browser with nothing uploaded.

Result

  • IPv4 address
    192.168.1.1
  • Binary (by octet)
    11000000.10101000.00000001.00000001
  • Binary (32 bits)
    11000000101010000000000100000001
  • Decimal integer
    3232235777
  • Hexadecimal
    0xC0A80101

How to use the ip to binary converter

  1. Type or paste an IPv4 address such as 192.168.1.1, an IPv6 address such as 2001:db8::1, or a binary string.
  2. Binary input can be 32 bits for IPv4 or 128 bits for IPv6, with or without dots, colons or spaces between the groups.
  3. Read the binary grouped by octet (IPv4) or by 16-bit group (IPv6), or copy the unbroken bit string.
  4. Use the decimal integer and hexadecimal rows when you need the same address as a single number.

How an IPv4 address becomes binary (ip to binary)

An IPv4 address is a 32-bit number written as four decimal octets. To convert each octet, write it as an 8-bit binary number by repeatedly subtracting the place values 128, 64, 32, 16, 8, 4, 2 and 1. For the first octet of 192.168.1.1: 192 = 128 + 64, so the bits are 11000000. The second octet 168 = 128 + 32 + 8, which is 10101000. The last two octets are 1, written 00000001.

Joining the four groups gives 11000000.10101000.00000001.00000001. Every octet is padded on the left with zeros to a full 8 bits, which is why the number 1 is not just a single digit. Reading the address as one 32-bit number gives 3232235777.

Binary to IP address: converting back

The reverse direction is the same idea read backwards. Split the 32 bits into four groups of 8, then add up the place values of every bit set to 1. The group 11000000 is 128 + 64 = 192. The group 10101000 is 128 + 32 + 8 = 168. This binary to ip calculator accepts the bits as four dotted groups, as one unbroken string, or separated by spaces.

For IPv6 the same rule applies with 128 bits split into eight groups of 16, and each group is shown as up to four hexadecimal digits. The result is written in the shortest standard form, with the longest run of zero groups replaced by a double colon.

IPv6 addresses in binary

An IPv6 address has 128 bits, written as eight groups of four hex digits. Each hex digit is exactly four bits, so conversion is direct: 2001 becomes 0010000000000001. Shortened forms are expanded first, so 2001:db8::1 is read as 2001:0db8:0000:0000:0000:0000:0000:0001 before it is converted. The loopback address ::1 is 127 zero bits followed by a single 1.

Embedded IPv4 notation such as ::ffff:192.0.2.1 is accepted too, with the last 32 bits taken from the dotted part.

Common addresses and their binary form

AddressBinary by octetMeaning
0.0.0.000000000.00000000.00000000.00000000Unspecified address
10.0.0.100001010.00000000.00000000.00000001Private 10.0.0.0/8 range
127.0.0.101111111.00000000.00000000.00000001Loopback
172.16.0.110101100.00010000.00000000.00000001Private 172.16.0.0/12 range
192.168.1.111000000.10101000.00000001.00000001Private 192.168.0.0/16 range
255.255.255.25511111111.11111111.11111111.11111111Limited broadcast

Why network engineers do ip to binary conversion

Binary shows what the dotted form hides. A subnet mask such as 255.255.255.0 is 24 ones followed by 8 zeros, and a bitwise AND of the address and the mask gives the network address. Seeing the bits makes it clear why a /26 splits a /24 into four blocks of 64 addresses, and why a host with 192.168.1.130 and a mask of 255.255.255.192 sits in the network 192.168.1.128.

Binary is also what you work with when you study for networking exams, write ACL wildcard masks, debug bit flags in packet captures, or implement CIDR matching yourself. To go straight from a prefix length to a mask or host count, use the subnet calculator. For the hexadecimal view of the same address, try the IP to hex converter.

Mistakes that break an IP address conversion

  • Leading zeros. An octet like 08 is rejected because some systems read it as octal. Write 8.
  • Octets above 255. An octet must fit in 8 bits, so 256 or more is invalid.
  • Dropping padding. Writing 192 as 11000000 is right, but writing 1 as 1 instead of 00000001 shifts every later bit.
  • Wrong bit count. Binary input must be exactly 32 bits for IPv4 or 128 for IPv6. Anything else cannot be an address.

Worked examples

ExampleInputResult
Private IPv4 to binaryIP address or binary value: 192.168.1.1IPv4 address: 192.168.1.1; Binary (by octet): 11000000.10101000.00000001.00000001; Binary (32 bits): 11000000101010000000000100000001; Decimal integer: 3232235777; Hexadecimal: 0xC0A80101
Binary to IP addressIP address or binary value: 11000000.10101000.00000001.00000001IPv4 address: 192.168.1.1; Binary (by octet): 11000000.10101000.00000001.00000001; Binary (32 bits): 11000000101010000000000100000001; Decimal integer: 3232235777; Hexadecimal: 0xC0A80101
IPv6 documentation addressIP address or binary value: 2001:db8::1IPv6 address: 2001:db8::1; Expanded: 2001:0db8:0000:0000:0000:0000:0000:0001; Binary (by 16-bit group): 0010000000000001:0000110110111000:0000000000000000:0000000000000000:0000000000000000:0000000000000000:0000000000000000:0000000000000001; Binary (128 bits): 00100000000000010000110110111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001; Decimal integer: 42540766411282592856903984951653826561
128 bits back to IPv6IP address or binary value: 1111111010000000:0000000000000000:0000000000000000:0000000000000000:0000000000000000:0000000000000000:0000000000000001:0000000000000010IPv6 address: fe80::1:2; Expanded: fe80:0000:0000:0000:0000:0000:0001:0002; Binary (by 16-bit group): 1111111010000000:0000000000000000:0000000000000000:0000000000000000:0000000000000000:0000000000000000:0000000000000001:0000000000000010; Binary (128 bits): 11111110100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000010; Decimal integer: 338288524927261089654018896841347760130

FAQ

How do I do ip to binary conversion by hand?

Convert each of the four decimal numbers to an 8-bit binary number and join them with dots. For 10.0.0.1 that gives 00001010.00000000.00000000.00000001.

Can this work as a binary to IP address calculator?

Yes. Paste 32 bits, with or without dots or spaces, and you get the dotted decimal IPv4 address. Paste 128 bits and you get the IPv6 address.

How many bits are in an IP address?

An IPv4 address has 32 bits and an IPv6 address has 128 bits. Every conversion of an IP address to binary produces one of those two lengths.

Does the IP address converter to binary support IPv6?

Yes. It expands shortened forms with a double colon, accepts an embedded IPv4 tail, and shows the result as eight groups of 16 bits.

Why is 192.168.1.1 shown as 3232235777?

The four octets are one 32-bit number: 192 x 16777216 + 168 x 65536 + 1 x 256 + 1. Tools and databases often store addresses this way.

Is my input sent anywhere?

No. The conversion runs entirely in your browser and nothing is uploaded.

How do I convert an IP address to binary by hand?

Whether you do the conversion of ip address to binary by hand or with this tool, each of the four IPv4 octets becomes eight bits. For 192.168.1.1 the result is 11000000.10101000.00000001.00000001.

Is this an IP address to binary calculator for IPv6 too?

Yes. As an ip address to binary calculator it turns an IPv4 address into 32 bits and an IPv6 address into 128 bits.

Sources and references