NetCalcLab

Binary to IP Converter

Convert a 32-bit binary string back into a dotted-decimal IPv4 address. Enter the bits with or without separators and the converter groups them into four octets for you.

Exactly 32 bits are required. Dots and spaces are optional separators.

Examples:

Grouping bits into octets

IPv4 addresses are written in dotted-decimal purely for human convenience. Underneath, the address is a single 32-bit number, and the dots are drawn every eight bits. To convert back, you reverse that: regroup the bits into four sets of eight and evaluate each group independently.

Converting one octet
1 0 1 0 1 1 0 0
| | | | | | | |
128 64 32 16 8 4 2 1   <- place value

Set bits:  128 + 32 + 8 + 4 = 172
Zero bits: 64, 16, 2, 1 contribute nothing

Example: 00001010.00000000.00000000.00000001

Go group by group. The first group 00001010 has a single set bit in the 8 position, giving 8 plus the 2 position, giving 10. The second and third groups are all zeros, giving 0 and 0. The last group 00000001 has only the 1 position set, giving 1.

Result: 10.0.0.1

Reading the first four bits of the first octet is a useful shortcut: 0000 is a class A address, 1000 to 1011 is class B, and 1100 to 1101 is class C.

Reading a mask written in binary

Binary is the natural notation for masks because a mask is defined as a run of ones followed by a run of zeros. In dotted-decimal you have to memorise which octet values are legal; in binary you simply count the ones.

Masks in binary and their prefixes
Binary maskDotted decimalPrefixHosts
11111111.11111111.11111111.00000000255.255.255.0/24254
11111111.11111111.11111111.10000000255.255.255.128/25126
11111111.11111111.11111111.11000000255.255.255.192/2662
11111111.11111111.11111111.11100000255.255.255.224/2730
11111111.11111111.11111111.11110000255.255.255.240/2814
11111111.11111111.11111111.11111000255.255.255.248/296
11111111.11111111.11111111.11111100255.255.255.252/302
11111111.11111111.11111111.11111110255.255.255.254/312 (RFC 3021)

The host bits are exactly the zeros at the end of the mask. Counting them is the fastest way to size a subnet: 8 host bits give 256 addresses, 7 give 128, and so on.

Common mistakes

  • Padding on the wrong side. Missing bits are always missing from the left, because they are leading zeros. Appending zeros on the right changes the address completely.
  • Reading bits right to left. The first bit carries 128. Reading in the wrong direction produces a value that looks reasonable but is mirrored.
  • Grouping into four from the right when the length is not 32. If the string is short, first pad it to 32 bits and only then split into octets.
  • Assuming all-ones octets are always broadcasts. 255 in the last octet is the broadcast address only when the mask makes it the host portion. 10.0.255.1 is a perfectly ordinary host in a /16.

Also: IP to Binary Converter · IP to Hex Converter · Hex to IP Converter · IP to Decimal Converter

Binary patterns worth recognising

Common binary prefixes and their meaning
First bitsFirst octet rangeMeaning
000000000This network / unspecified
00000001 – 011111101 – 126Class A public space
01111111127Loopback range
10000000 – 10111110128 – 190Class B public space
10111111191Top of class B
11000000 – 11011111192 – 223Class C public space
11100000 – 11101111224 – 239Multicast (class D)
11110000 – 11111111240 – 255Reserved (class E)
11111111.11111111...255.255...Broadcast or all-ones mask

This page is one of a set: convert the other way with IP to binary, or use the subnet calculator and the CIDR calculator.

Frequently asked questions

How do I convert binary to an IP address?

Split the 32 bits into four groups of eight, then convert each group to decimal and join them with dots. For 11000000.10101000.00000001.00000001 the four groups are 11000000, 10101000, 00000001 and 00000001, which are 192, 168, 1 and 1, giving 192.168.1.1.

What if my binary has no separators?

Group it into four sets of eight from the left. The bit order is fixed and always starts with the most significant bit, so 11000000101010000000000100000001 splits unambiguously into 11000000 10101000 00000001 00000001. If the string is not exactly 32 bits long, it is not a complete IPv4 address — pad it on the left with zeros rather than on the right.

Why does my binary have only 31 or 30 bits?

That happens when a leading zero was dropped somewhere. Every octet must contribute exactly eight bits, so the total is always 32. Adding zeros at the front restores the missing bits: 1100000101010000000000010000001 is not valid, but padding it to 32 bits gives a meaningful address.

How do I convert an 8-bit group by hand?

Multiply each bit by its place value — 128, 64, 32, 16, 8, 4, 2, 1 — and add the results. For 10101100: 128 + 32 + 8 + 4 = 172, since the 64, 16, 2 and 1 positions hold zeros.

What does all-ones binary mean?

11111111 is 255. An address made entirely of ones (11111111.11111111.11111111.11111111) is 255.255.255.255, the limited broadcast address, which is delivered to every host on the local link and never routed.

Can I convert a binary string with spaces or dashes?

Yes. This converter strips dots, spaces and other separators before grouping, so 11000000 10101000 00000001 00000001 and 11000000.10101000.00000001.00000001 both produce 192.168.1.1. Any character that is not a 0 or a 1 is ignored in the grouping step, but the remaining bits must total exactly 32.