Educational explanation, not professional design advice. Last reviewed 24 October 2026. Disclaimer
In plain English
Every device on a network needs an address so that data reaches the right place, just as every house needs a postal address. An IP address is that address. The subnet mask says which part of the address names the street (the network) and which part names the house (the device). Devices on the same network can talk directly; to reach other networks they go through a router.
Technical definition
An IPv4 address is a 32-bit number (RFC 791), written as four decimal octets separated by dots, such as 192.168.1.25. A subnet mask is a 32-bit value whose 1-bits mark the network prefix and 0-bits the host part. In CIDR notation (RFC 4632) the mask is written as the number of 1-bits: 255.255.255.0 is /24.
How it works and where it is used
The network address is found by a bitwise AND of the address and the mask. In a normal subnet, the first address (all host bits 0) identifies the network and the last (all host bits 1) is the broadcast address, so the usable host addresses lie between them. RFC 1918 reserves three ranges for private networks, used inside homes, offices and factories: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16.
Formula
Addresses in a subnet = 2(32 − prefix) Usable hosts = 2(32 − prefix) − 2
Network = address AND mask Broadcast = network OR (NOT mask)
The “− 2” does not apply to /31 point-to-point links (RFC 3021) or to /32 single-host routes.
Worked example
Address 192.168.1.25 with mask 255.255.255.0 (/24):
- Network: 192.168.1.0; broadcast: 192.168.1.255
- Addresses: 2⁸ = 256; usable hosts: 254 (192.168.1.1 to 192.168.1.254)
- With /26 (255.255.255.192) instead: 64 addresses, 62 usable; 192.168.1.25 lies in the subnet 192.168.1.0–192.168.1.63.
In the workshop and in practice
In a workshop or factory, PLCs, HMIs, CNC machines, IP cameras and printers on an industrial network are often given fixed addresses in a private range. Knowing the subnet mask explains why a laptop on 192.168.1.x cannot reach a machine set to 192.168.0.x without a change of settings or a router.
Common mistakes and misconceptions
- Giving two devices the same address, which causes intermittent connection faults.
- Using the network or broadcast address for a device.
- Mismatched masks on devices that should be in the same subnet.
- Assuming public and private addresses are interchangeable. Private addresses are not routed on the public internet.
Safety note
Industrial control networks should be kept separate from office and internet traffic and changed only with the permission of whoever is responsible for them; a wrong address can stop production equipment.
Related calculators
- IPv4 Subnet & Address Range Calculator — Network, broadcast and usable host range of an IPv4 subnet from CIDR or subnet mask.
- CIDR & Subnet Mask Converter — CIDR prefix ↔ subnet mask, with wildcard mask, host bits and number of addresses.
- IPv6 Address Expander, Compressor & Prefix Tool — Validate, expand and compress IPv6 addresses, identify the type, and find a prefix’s range.
- Binary, Decimal, Hex & Octal Converter — Convert whole numbers between base 2, 8, 10 and 16 — exact for any size, with two’s complement.
Related topics
- Binary Numbers — The base-2 number system computers use, written with only 0 and 1.
References
- IETF RFC 791: Internet Protocol (IPv4)
- IETF RFC 4632: Classless Inter-domain Routing (CIDR)
- IETF RFC 1918: Address Allocation for Private Internets
- IETF RFC 3021: Using 31-Bit Prefixes on IPv4 Point-to-Point Links
