Network Addressing

IPv4 to binary

Direction
IPv4 address
Binary, by octet 00001010 00010100 00011110 00101000
Eight bits per octet, 32 in total
Address 10.20.30.40
Integer 169090600
Hexadecimal 0x0A141E28
Octets 10 · 20 · 30 · 40
Note
32 bits · prefixes count leading ones

A prefix length is simply a count of leading bits. A /26 fixes the first 26 bits and leaves 6 free, giving 64 addresses. In dotted-quad that boundary looks arbitrary: 255.255.255.192, but in binary it is obvious: 26 ones followed by 6 zeros. Every subnetting rule becomes clear once the address is written as bits, which is why it is always taught this way.

Advertisement
320 × 100

Each octet becomes eight bits, giving 32 in total. 10.20.30.40 is 00001010 00010100 00011110 00101000. Subnet prefixes count leading bits, which is why binary is the form subnetting is taught in.

How to convert an IP to binary

1 Enter the address as a dotted quad.
2 Read the 32 bits, grouped into four octets of eight.
3 Count leading bits from the left to see where a prefix boundary falls.
4 The integer and hex forms sit alongside for anything that wants a packed value.

Reading the binary makes the private ranges recognisable. Anything starting 00001010 is 10.x, a whole /8. Anything starting 11000000 10101000 is 192.168.x. And 10101100 0001 followed by four variable bits is 172.16 to 172.31 — the range people misremember, because a /12 boundary falls inside the second octet rather than tidily between two.

A mask is just a count of leading ones. A /26 is 11111111 11111111 11111111 11000000, which in dotted quad is the arbitrary-looking 255.255.255.192. Two facts follow directly from the bits: AND the address with the mask and every host bit clears, giving the network address; set every host bit instead and you have the broadcast. Six free bits means 64 addresses, of which 62 are usable once those two are spoken for.

This converts an address and nothing more. It does not accept a /26 suffix, does not work out a network, broadcast or usable range, and does not judge whether the address is routable; the subnet calculator does all of that. What it gives you is the 32 bits, which is the form every subnetting rule is actually written in.

Questions

Thirty-two — four octets of eight bits each.

Advertisement
300 × 250
Was this tool any good?
Internal signal only · I use it to find the tools worth rebuilding