Prefix
The number of leading bits in an IP address that define the network portion, written after the slash in CIDR notation.
A prefix (prefix length) is the number of leading bits in an IP address that define the network portion, written as the number after the slash in CIDR notation. In 192.168.1.0/24 the prefix is 24, and in 2001:db8::/64 the prefix is 64.
The prefix directly determines how large a subnet is. The number of addresses in an IPv4 subnet is 2^(32 − prefix): /24 gives 256 addresses (254 usable), /26 gives 64, /30 gives 4. For IPv6 it is 2^(128 − prefix), and /64 is the standard subnet size for one LAN. Common IPv6 boundaries include /32 for an RIR allocation to an LIR, /48 for a site, /56 for a residential customer and /64 per LAN segment — see IPv6 prefix for the full hierarchy.
In routing tables, BGP announcements and firewall rules, the prefix is what controls how precisely a network is identified. A longer prefix (larger number) is more specific and wins under longest-prefix match during routing: if a router holds both 10.0.0.0/8 and 10.1.2.0/24, traffic to 10.1.2.5 follows the /24 because it is the most specific match. BGP operators also use minimum prefix-length filters (typically /24 in IPv4 and /48 in IPv6) to refuse deaggregated routes that would otherwise bloat the global table.
The prefix is only the number — the notation network/prefix itself is CIDR. In IPv4 the same information can also be expressed as a subnet mask in dotted-decimal form, where /24 = 255.255.255.0 and /30 = 255.255.255.252. Prefixes work for both IPv4 and IPv6; subnet masks are an IPv4 convention.
Key Points
- Number of leading bits that define the network portion
- Written after the slash in CIDR, e.g.
/24or/64 IPv4addresses:2^(32 − prefix)—/24= 256,/30= 4IPv6typically uses/64per LAN segment- Longer prefix wins under longest-prefix-match routing
- BGP filters often reject prefixes longer than
/24(v4) or/48(v6) - Prefix = number; CIDR = notation; subnet mask =
IPv4form of the same number