Network Address Calculator – Find Subnet Network ID via AND

Network Address Calculator

Find the network (subnet) address of any IPv4 host by ANDing the address bit for bit with its subnet mask. Enter the four octets and a CIDR prefix or dotted mask to get the network ID, the mask used, the address class, and whether the host is private, public, loopback, APIPA, or reserved.

🎯Real Address Presets

📝Address Inputs

. . .

The host address you want to resolve to its network ID.

Choose how you supply the subnet mask below.

Number of leading 1 bits in the mask.

. . .

The tool converts this to a prefix automatically.

Displays the bit-by-bit AND of IP and mask.

Detects class A to E and RFC 1918 or reserved use.

Network (Subnet) Address 0.0.0.0 host bits set to zero
Subnet Mask Used 0.0.0.0 prefix length
Address Class and Type - public or private
Changed Octet - where AND altered the IP

🔱Quick Reference Snapshot

ANDIP & mask
/24255.255.255.0
RFC1918 private
127loopback /8

📊Worked Bitwise AND Example

OctetIP 192.168.1.77Mask 255.255.255.0AND Result
1st11000000 (192)11111111 (255)11000000 (192)
2nd10101000 (168)11111111 (255)10101000 (168)
3rd00000001 (1)11111111 (255)00000001 (1)
4th01001101 (77)00000000 (0)00000000 (0)
IDHost portion clearedZero bits mask host192.168.1.0

📋Class Default Masks and Ranges

ClassFirst OctetLeading BitsDefault MaskDefault Prefix
Class A1 to 1260xxxxxxx255.0.0.0/8
Class B128 to 19110xxxxxx255.255.0.0/16
Class C192 to 223110xxxxx255.255.255.0/24
Class D224 to 2391110xxxxMulticast, no maskn/a
Class E240 to 2551111xxxxExperimentaln/a
Loopback127Reserved255.0.0.0/8

🔑Private and Special-Use Blocks

BlockRangePrefixPurposeRoutable on Internet
10.0.0.010.0.0.0 - 10.255.255.255/8Private class A (RFC 1918)No
172.16.0.0172.16.0.0 - 172.31.255.255/12Private class B (RFC 1918)No
192.168.0.0192.168.0.0 - 192.168.255.255/16Private class C (RFC 1918)No
127.0.0.0127.0.0.0 - 127.255.255.255/8Loopback (localhost)No
169.254.0.0169.254.0.0 - 169.254.255.255/16APIPA link-local, no DHCPNo
100.64.0.0100.64.0.0 - 100.127.255.255/10Carrier-grade NAT (RFC 6598)No
224.0.0.0224.0.0.0 - 239.255.255.255/4Multicast (class D)Special

🗃Address Type Comparison Grid

BlockRangeClassPrimary UseRoutableExample Host
10.0.0.0/810.0.0.0 - 10.255.255.255ALarge private LANNo10.20.30.40
172.16.0.0/12172.16.0.0 - 172.31.255.255BMid private LANNo172.16.5.9
192.168.0.0/16192.168.0.0 - 192.168.255.255CHome and SOHO LANNo192.168.1.77
100.64.0.0/10100.64.0.0 - 100.127.255.255ACarrier CGNATNo100.64.7.3
169.254.0.0/16169.254.0.0 - 169.254.255.255BLink-local APIPANo169.254.9.9
127.0.0.0/8127.0.0.0 - 127.255.255.255ALoopback localhostNo127.0.0.1
203.0.113.0/24203.0.113.0 - 203.0.113.255CDocumentation (RFC 5737)No203.0.113.65
224.0.0.0/4224.0.0.0 - 239.255.255.255DMulticast groupsSpecial224.0.0.5
8.0.0.0/88.0.0.0 - 8.255.255.255APublic unicastYes8.8.8.8
203.0.114.0/24Sample public /24CPublic unicastYes203.0.114.20

⚙Formula Breakdown

IP to integerPack the four octets into one 32-bit number: ipInt = o1 x 16777216 + o2 x 65536 + o3 x 256 + o4. For 192.168.1.77 that is 3232235853.
Mask from prefixmask = 0xFFFFFFFF shifted left by (32 minus prefix), kept unsigned. A /24 gives 255.255.255.0, which is 24 ones then 8 zeros.
Network = IP AND maskBitwise AND keeps a bit only when both IP and mask have a 1 there. Host bits, where the mask is 0, are forced to 0.
AND truth table1 AND 1 = 1, 1 AND 0 = 0, 0 AND 1 = 0, 0 AND 0 = 0. Only a mask bit of 1 lets an IP bit survive into the network ID.
Back to dottedSplit the network integer into octets: (net >>> 24) & 255, (net >>> 16) & 255, (net >>> 8) & 255, net & 255.
Class detectionThe first octet sets the class: 1 to 126 is A, 128 to 191 is B, 192 to 223 is C, 224 to 239 is D, 240 plus is E.
Type detectionCompare the IP against RFC 1918, 127.0.0.0/8, 169.254.0.0/16 and 100.64.0.0/10 to flag private, loopback, APIPA or CGNAT.

💡Subnetting Tips

Only octets under the boundary change: A /24 mask has 255 in the first three octets, so ANDing leaves them untouched and only zeroes the 4th octet. With a /26 the first three octets stay, and the 4th snaps down to the nearest multiple of 64: an address ending in 130 lands in the 128 subnet.
Count host bits to size the block: Host bits equal 32 minus the prefix, so a /26 leaves 6 host bits and 2 to the 6th power equals 64 addresses per subnet. Subtract 2 for the network and broadcast addresses to get 62 usable hosts, a fast sanity check while you plan a subnet.

The secret identity of each IPv4 address are used by routers to route through Internet. What you’re seeing are those addresses as dotted decimals on a computer screen. But the identity itself isn’t obvious.

The calculator above displays precise operation performed by a router, all in plain view. One easy step after another. First it performs bitwise AND between your host address and its subnet mask. The host bits is removed. Now we can see what they have in common: the network prefix. And that’s what gets listed in firewall rules and other routing table. It is basic building block of network topology. In other words, the network address is first address within a subnet block with all host bits zeroed. So if you’re located on 192.168.1.77 within a /24 subnet, that means the network address for your device are 192.168.1.0. It’s just one number that marks border of your local segment. It’s what firewalls refer to as they allow and deny traffic. It’s what you would document in an IP allocation.

How to Find Your Network Address

Everything beneath the mask boundary is host part. All we care about is shared portion of the network prefix, which is why we can discard it. For example, that’s simply 1 bit followed by 0 bits (a subnet mask). The ones represent the network part, the zeros are host part. The bitwise AND operation simply looks at each bit from both numbers and compares them according to a very simple rule: if there’s a one and a one you get a one; otherwise you get a zero. Every host bit gets ANDed against a zero mask bit so they collapse to zero. Every network bit gets ANDed against a one mask bit, which retains their value unchanged. It results in your address with all the host bits removed. If you’re wondering what’s going on, flip on binary display in this calculator and you’ll see the whole 32 bits align and match up.

The tool takes either description for a mask, you can specify it by how many leading 1 bits there is (CIDR notation), or in dotted decimal format. 255.255.255.0 is a /24; it has 24 1 bits followed by 8 zero bits. That becomes a /26 when two more 1 bits are added to the fourth octet: 255.255.255.192. Type in a dotted decimal mask, and software will tally up number of 1 bits. It will recover the prefix value from that so you can see how what you’re typing matches what you’ve seen written as shorthand in configuration files.

Let’s look at 192.168.1.130 with prefix /26. Since we’re doing AND with 255 on the first three octets, the mask lets those octets pass through unaltered: 192, 168 and 1 remain the same. Octet 4, the 130, is 10000010 in binary. The mask byte of 192 are 11000000. If you do an AND between these two, you retain only high-order two bits. You get 10000000, or 128. Therefore, the network address is 192.168.1.128.

For most folks this is when light bulb turns on and subnetting makes sense. The mask doesn’t “subtract,” it filters. A couple of clicks later, you see the historical class in the first octet of an address. For example, values from 1 through 126 are Class A (default /8). The values from 192 through 223 is Class C (/24). Although moddern routing has become classless, this range of addresses still defines blocks of addresses set aside for special use. Special-use ranges are flagged automatically by the calculator. It recognizes 10.0.0.0/8 and 172.16.0.0/12 as private networks not suitable for traveling the public internet. It detects 127.0.0.0/8 as loopback. It detects 169.254.0.0/16 as APIPA link-local assigned if DHCP fails. It even recognizes 100.64.0.0/10 as carrier-grade NAT. Once you know what it is, you immediately knew if the address is routable.

The key to all routing decisions is getting the network address correct. A route points at a network address and prefix. You cannot talk directly to another host without a router unless your network ID matches that other host’s network ID. Traffic will go the wrong direction and it won’t be noticed if you get the network address confused with the broadcast address or any usable host address. The AND operation separates the network address cleanly. That’s separate from the broadcast address (derived via an OR). The calculator makes sure that difference stay clear.

Begin with a relevant preset: maybe it’s an office VLAN or perhaps just a home LAN. Next tweak the octets to learn something. When it’s time to see where the mask bites down in binary? Do it. You can see the Type, Class, network address, and mask all on one screen. The calculator makes what was once a strange bit operation clear and reliable. It is a tool you can take directly from the calculator right into a diagram or config. Making sense of the invisible boundaries that shape our digital conversations.

Network Address Calculator – Find Subnet Network ID via AND