How a subnet mask splits an address
An IPv4 address is 32 bits, usually written as four decimal bytes. A subnet mask splits those bits into a network part and a host part: every bit set to 1 in the mask belongs to the network, every 0 belongs to the host. Because the ones must be contiguous, the mask can be summarized by a single count - the prefix length - which is what the slash in 192.168.1.0/24 means. A /24 has 24 network bits and 8 host bits, so its mask is 255.255.255.0.
The network address is the address with every host bit set to 0; the broadcast address has every host bit set to 1. Neither can be assigned to a device, which is why a subnet with n host bits holds 2^n addresses but only 2^n - 2 usable hosts. For a /24: 2^8 = 256 addresses, 254 usable, from .1 to .254. For a /26: 2^6 = 64 addresses, 62 usable. The gateway conventionally takes the first or last usable address, but that is a habit, not a rule.
A worked example
Take 192.168.1.10/26. The mask is 26 ones then 6 zeros: 11111111.11111111.11111111.11000000 = 255.255.255.192. AND the address with the mask and the last 6 bits are cleared, giving the network 192.168.1.0. OR the network with the wildcard (the inverted mask, 0.0.0.63) and you get the broadcast, 192.168.1.63. Usable hosts run from 192.168.1.1 to 192.168.1.62 - 62 of them. The next subnet starts at 192.168.1.64, then .128, then .192, which is why /26 boundaries land on multiples of 64.
The wildcard mask is that inverted mask, and it is not just an intermediate step: Cisco access lists and OSPF network statements are written with wildcards rather than subnet masks, so /24 appears as 0.0.0.255. Two prefixes behave specially. A /31 has no network or broadcast address at all - RFC 3021 allows both addresses to be hosts, which saves addresses on point-to-point links. A /32 is a single address, used for loopback interfaces and host routes.
Private ranges, classes and planning
Three ranges are reserved for private use by RFC 1918 and are never routed on the public internet: 10.0.0.0/8, 172.16.0.0/12 (that is 172.16 through 172.31, not 172.16 through 172.16.255) and 192.168.0.0/16. Alongside them, 127.0.0.0/8 is loopback, 169.254.0.0/16 is the link-local range a machine assigns itself when DHCP fails, and 100.64.0.0/10 is carrier-grade NAT space used inside ISP networks. Anything else in 1-223 is publicly routable; 224-239 is multicast and 240-255 is reserved.
The old address classes - A for 1-126, B for 128-191, C for 192-223 - have not governed routing since CIDR arrived in 1993, but the vocabulary survives in documentation and exams, so this calculator still reports the class. Plan subnets by host count, rounding up to a power of two and leaving headroom: 30 devices need a /26 (62 hosts), not a /27 (30 hosts), because the gateway, printers and DHCP reservations all consume addresses. Keep subnets on natural boundaries so that summarization stays simple, and remember that a very large flat subnet like a /16 means broadcast traffic reaching 65,000 hosts.