Advertisement

IP to Binary Converter

Convert an IP address to binary octets and back. Add a /prefix to see network and host bits, the subnet mask in binary and the network address.

IPv4 or IPv6, optionally with /prefix. Binary input: 32 bits, or four 8-bit groups separated by dots.

Subnetting only makes sense once you see addresses as bits. This tool writes an IPv4 address as four 8-bit octets (and IPv6 as eight 16-bit groups), shows which place values make up each octet, and turns binary back into a normal address. Add a prefix such as /26 to see the network and host bits, the subnet mask in binary and the network address.

How to use this tool

  1. Enter an address such as 192.168.1.10, optionally with a prefix length like /24.
  2. Or paste binary — 32 bits, or four 8-bit groups separated by dots — to get the address back.
  3. Read the octet table to see which place values (128, 64, 32 … 1) are switched on.
  4. Paste several lines to convert a whole list.

Formula

octet = b₇×128 + b₆×64 + b₅×32 + b₄×16 + b₃×8 + b₂×4 + b₁×2 + b₀×1

Each IPv4 octet is a number from 0 to 255, written as exactly eight bits. With a /n prefix the first n bits are the network part: the subnet mask is n ones followed by zeros, and the network address is the address AND the mask, bit by bit. Leading-zero IPv4 octets are read as decimal. Paired IPv6 brackets are accepted; zone identifiers must be removed explicitly.

Example

For 192.168.1.130/25: 192 = 128 + 64 → 11000000, 168 = 128 + 32 + 8 → 10101000, 1 → 00000001 and 130 = 128 + 2 → 10000010. A /25 mask is 25 ones, 11111111.11111111.11111111.10000000 (255.255.255.128). In the last octet, 10000010 AND 10000000 = 10000000 = 128, so the network address is 192.168.1.128, leaving 7 host bits.

Frequently asked questions

Why is every octet eight digits long?

An octet is exactly 8 bits. Writing 1 as 00000001 keeps the bit positions lined up, which you need when comparing an address with a mask.

How do I find the network address in binary?

Write the address and the mask in binary and compare them bit by bit: the result has a 1 only where both have a 1. Adding /prefix to the input does this for you.

How many hosts does a prefix allow?

With h host bits there are 2^h addresses. In IPv4, two are normally reserved for the network and broadcast addresses, so /24 gives 254 usable hosts and /30 gives 2; /31 and /32 are special cases.

Does it work with IPv6?

Yes. "::" shorthand is expanded first and the address is shown as 128 bits in eight 16-bit groups.

Sources

Last updated: 2026-10-30

Advertisement