Audited ·Last updated 28 Jul 2026·6 citations·Tier 1·0 uses

IP Subnet Calculator (CIDR)

Enter an IPv4 address and a CIDR prefix to get the network address, broadcast address, usable host range, subnet mask and RFC 6890 address scope.

IP Subnet Calculator (CIDR)

Any address inside the subnet — the network address is derived from it, so you do not need to know the network boundary in advance. Dotted decimal only; leading zeros (192.168.010.1) are rejected because they mean octal in some parsers and decimal in others.
The number after the slash in CIDR notation — the count of leading 1-bits in the subnet mask, 0 to 32 (RFC 4632). /24 is 255.255.255.0.
Network address
192.168.10.0
The first address in the block — the address with every host bit set to zero. On prefixes of /30 and shorter this address identifies the subnet and cannot be assigned to a host.
Network in CIDR notation
192.168.10.0/26
Broadcast address
192.168.10.63
First usable host
192.168.10.1
Last usable host
192.168.10.62
Subnet mask
255.255.255.192
Total addresses in block
64
Usable host addresses
62
Address scope
Private-Use — 192.168.0.0/16 (RFC 1918)

Background.

Subnetting is address arithmetic, and address arithmetic is where careful engineers still make careless mistakes. Give this calculator any IPv4 address that sits inside the subnet you care about, plus the CIDR prefix length, and it returns the six facts you actually need to configure something: the network address, the broadcast address, the first and last assignable host addresses, the dotted-decimal subnet mask, and how many hosts the block will hold. It also tells you which block of the IANA special-purpose registry your address falls into, so you can see at a glance whether you are working in RFC 1918 private space, the RFC 6598 carrier-grade NAT range, link-local space, or genuinely routable public address space.

The reason you supply a host address rather than the network address is that most of the time you do not know the network address yet — that is precisely the thing you are trying to find out. If a device reports 192.168.10.37/26, the subnet boundary is not obvious by inspection, because a /26 splits each /24 into four blocks that begin at .0, .64, .128 and .192. The address .37 falls in the first of those, so the network is 192.168.10.0/26 and the broadcast is 192.168.10.63 — but change the prefix to /27 and the same address lands in the 192.168.10.32 block instead. Masking the host bits off is exactly what this tool does for you, and it does it for every prefix from /0 to /32.

CIDR replaced the old Class A, B and C system in 1993. RFC 4632, the current CIDR specification, describes a prefix as a four-octet quantity followed by a slash and "a decimal value between 0 and 32 that describes the number of significant bits", and states the goal plainly: to deprecate the Class A/B/C network address assignment system in favour of classless, hierarchical blocks. Classful reasoning still lingers in habits and in older documentation — people say "a Class C" when they mean a /24 — but no modern router, firewall or cloud VPC infers a mask from the first octet. The prefix is always explicit, which is why every field on this page asks for it explicitly too.

Two rules trip people up often enough to be worth stating up front. The first is the host count. For a prefix of /30 or shorter you lose two addresses per subnet: the all-zeros network address and the all-ones broadcast address are reserved, so a /24 gives 256 total addresses but only 254 usable ones. The second is that this rule stops applying at /31 and /32. RFC 3021 permits 31-bit prefixes on point-to-point links, where "only two possible addresses may result" and both "MUST be interpreted as host addresses" — there is no network or broadcast address to reserve, so a /31 gives 2 usable hosts, not zero. A /32 is a single-host route with exactly one usable address. Calculators that blindly apply the minus-two rule report 0 and -1 usable hosts for these two prefixes, which is not merely unhelpful but wrong; this one implements the standards instead.

A note on scope: this calculator handles IPv4 only. IPv6 uses the same slash notation but a 128-bit address space with no broadcast address at all, and the host-counting rules and special-purpose registry are entirely different, so folding both into one page would mean two sets of rules fighting over the same output labels. If you need the prefix-to-mask translation on its own — including the reverse direction, mask to prefix, and the binary and hexadecimal forms of the mask — use the companion CIDR to netmask converter, which deliberately does not ask for an address.

What is ip subnet calculator (cidr)?

An IP subnet is a contiguous, power-of-two-sized block of IPv4 addresses identified by a network address and a prefix length. The prefix length says how many of the address's 32 bits are fixed across the whole block (the network portion); the remaining bits vary from address to address (the host portion). Written in CIDR notation, 192.168.10.0/26 means the first 26 bits are the network and the last 6 bits — 64 combinations — enumerate the addresses inside it.

The subnet mask is the same information in a different costume: a 32-bit value whose leading bits are ones wherever the prefix covers and zeros elsewhere. RFC 4632 describes the /16 case as a mask "where the most significant 16 bits are ones and the least significant 16 bits are zeros", which in dotted decimal is 255.255.0.0. A router derives the network address by taking the bitwise AND of a host address with the mask — a step this calculator performs as exact integer arithmetic rather than with JavaScript's bitwise operators, which coerce to signed 32-bit values and would render every mask above /0 as a negative number.

Three addresses in a normal subnet have special meanings. The network address (all host bits zero) names the subnet in routing tables. The broadcast address (all host bits one) reaches every host on the link. Everything in between is assignable. The two exceptions are /31, which under RFC 3021 carries two host addresses and no broadcast, and /32, which is a single-host route used for loopback interfaces, anycast service addresses and host routes injected into a routing protocol.

How to use this calculator.

  1. Type any IPv4 address that belongs to the subnet — the address of a server, a router interface, or a DHCP lease you are looking at. You do not need to know the network address; deriving it is the point.
  2. Enter the prefix length: the number after the slash in CIDR notation, or the count of 1-bits in the dotted-decimal mask (255.255.255.0 is /24, 255.255.255.192 is /26).
  3. Read the network address and CIDR notation line — this is the string you paste into a route statement, a firewall object, or a cloud VPC subnet definition.
  4. Use the first and last usable host figures to plan static assignments and DHCP pool boundaries; keep the pool strictly inside that range.
  5. Check the total-versus-usable address counts before committing to a prefix. A /29 sounds like eight addresses but only holds six devices, and gateways, printers and management interfaces eat into that fast.
  6. Read the address-scope line to confirm you are in the space you meant to be in. Discovering that a 'private' range is actually 100.64.0.0/10 carrier-grade NAT space, or that an address is in the 192.0.2.0/24 documentation range, saves hours of confused troubleshooting.
  7. For point-to-point links between routers, try /31: it gives you two host addresses out of two, instead of the two-out-of-four a /30 gives you.
  8. If you only need the mask that corresponds to a prefix (or the prefix that corresponds to a mask), use the CIDR to netmask converter instead — it does not ask for an address and it works in both directions.

The formula.

network = ⌊ip ÷ 2^(32−p)⌋ × 2^(32−p) · mask = 2^32 − 2^(32−p)

Every step happens on the address's 32-bit unsigned integer value. The dotted-decimal address o0.o1.o2.o3 becomes ((o0 × 256 + o1) × 256 + o2) × 256 + o3, a value from 0 to 4,294,967,295.

The block size is 2^(32 − p), where p is the prefix length: a /26 has 2^6 = 64 addresses, a /24 has 2^8 = 256, a /0 has all 2^32 = 4,294,967,296. The subnet mask as an integer is 2^32 − blockSize, which is the same thing as p leading 1-bits followed by (32 − p) zeros; converting that integer back to dotted decimal gives 255.255.255.192 for a /26.

The network address is the address rounded down to the nearest multiple of the block size: floor(ip ÷ blockSize) × blockSize. That is arithmetically identical to the bitwise AND of the address with the mask, but it avoids JavaScript's signed 32-bit bitwise coercion, under which 0xFFFFFFC0 | 0 evaluates to −64. The broadcast address is network + blockSize − 1.

Host counting then branches on the prefix. For p ≤ 30, both the network and broadcast addresses are reserved, so usable hosts = blockSize − 2 and the assignable range runs from network + 1 to broadcast − 1. For p = 31, RFC 3021 defines the two addresses as host addresses on a point-to-point link, so usable hosts = 2 and the range is the two addresses themselves; the calculator reports no broadcast address rather than mislabelling the second host. For p = 32 there is one address, one usable host, and again no broadcast.

The address-scope output is a lookup, not a computation: the entered address is tested against the IANA IPv4 Special-Purpose Address Registry as published in RFC 6890, from the most specific block to the least specific, and the registry's own block name is reported. If nothing matches, the address is globally routable public unicast.

A worked example.

Example

A switch reports a server at 192.168.10.37/26 and you need to know the subnet boundaries before adding a second server beside it. The block size is 2^(32−26) = 2^6 = 64 addresses, so each /24 is carved into four /26 blocks starting at .0, .64, .128 and .192. As an integer the address is 192 × 2^24 + 168 × 2^16 + 10 × 256 + 37 = 3,232,238,117; rounding that down to the nearest multiple of 64 gives floor(3,232,238,117 ÷ 64) × 64 = 50,503,720 × 64 = 3,232,238,080, which converts back to 192.168.10.0. The network is therefore 192.168.10.0/26 and the broadcast is 3,232,238,080 + 63 = 3,232,238,143 = 192.168.10.63. The assignable range runs 192.168.10.1 through 192.168.10.62 — 62 usable hosts out of 64 total addresses. The mask is 26 ones followed by 6 zeros, 11111111.11111111.11111111.11000000, which is 255.255.255.192. Finally, 192.168.10.37 sits inside 192.168.0.0/16, so the scope line reads Private-Use (RFC 1918): this address is not globally routable and needs NAT to reach the internet. Change nothing but the prefix and the answer moves: at /27 the block size halves to 32, the same .37 address lands in the 192.168.10.32 block, and the usable range becomes .33 to .62 with 30 hosts.

prefix Length26
ip Address192.168.10.37

Frequently asked questions.

How many usable hosts are in a /24, /26 or /29?
A /24 has 2^8 = 256 total addresses and 254 usable ones. A /26 has 2^6 = 64 total and 62 usable. A /29 has 2^3 = 8 total and 6 usable. In each case two addresses are subtracted: the all-zeros network address that names the subnet in routing tables and the all-ones broadcast address. The general rule for any prefix p from /0 to /30 is 2^(32−p) total addresses and 2^(32−p) − 2 usable ones. That rule stops at /30 — see the /31 question below.
Why does a /31 show 2 usable hosts instead of 0?
Because RFC 3021 says so. On a point-to-point link there is no need for a broadcast address, since every frame sent reaches exactly one other device. RFC 3021 states that with a 31-bit prefix "only two possible addresses may result" and that both "MUST be interpreted as host addresses". Applying the usual minus-two rule to a /31 would give zero usable hosts, which is why so many calculators print nonsense here. The practical benefit is real: RFC 3021 notes that a network with 500 point-to-point links saves 1,000 addresses by using /31 instead of /30.
What is the difference between a subnet mask and a CIDR prefix?
They carry identical information in two notations. The prefix length counts the leading 1-bits; the subnet mask writes those bits out as a dotted-decimal number. RFC 4632 gives the mapping directly: a /16 means "the mask to extract the network portion of the prefix is a 32-bit value where the most significant 16 bits are ones and the least significant 16 bits are zeros", which is 255.255.0.0. /24 is 255.255.255.0, /26 is 255.255.255.192, /30 is 255.255.255.252. Routers, firewalls and cloud consoles accept one form or the other, and increasingly only the prefix form.
Is my address private or public?
The scope output answers this from the IANA IPv4 Special-Purpose Address Registry published in RFC 6890. Private-use space is the three RFC 1918 blocks: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. Beyond those, several ranges look public but are not routable: 100.64.0.0/10 is Shared Address Space for carrier-grade NAT (RFC 6598), 169.254.0.0/16 is link-local (an address here usually means DHCP failed), 127.0.0.0/8 is loopback, and 192.0.2.0/24, 198.51.100.0/24 and 203.0.113.0/24 are reserved for documentation and must never appear in a live network.
Why did you ask for a host address instead of the network address?
Because in practice the network address is the unknown. You see 192.168.10.37/26 on a device and want to know which block it belongs to. Masking the host bits off is the whole calculation. Entering the network address works too — masking an address that is already on a block boundary simply returns it unchanged — so you can use whichever address you have to hand.
What does /0 mean?
A /0 prefix fixes zero bits, so it matches every IPv4 address: 0.0.0.0/0 is the default route. It contains all 4,294,967,296 IPv4 addresses. You will see it in routing tables as the route of last resort and in firewall rules as "any source" or "any destination". Because it matches everything, a /0 in an access rule is worth a second look before you deploy it.
Why are leading zeros rejected in the address field?
Because they are genuinely ambiguous. The classic C library function inet_aton interprets an octet with a leading zero as octal, so 010 means 8; most modern language runtimes and web frameworks parse the same string as decimal 10. That disagreement has produced real access-control bypasses where a validator and a network stack disagreed about which address a string denotes. Rather than pick a side silently, this calculator refuses the input and tells you to drop the zero.
How do I split a /24 into smaller subnets?
Borrow host bits. Each additional bit of prefix halves the block size and doubles the number of blocks. A /24 (256 addresses) becomes two /25s of 128, four /26s of 64, eight /27s of 32, sixteen /28s of 16, or thirty-two /29s of 8. The blocks always start on multiples of the block size, which is why a /26 of 192.168.10.0/24 starts at .0, .64, .128 and .192 and never at, say, .50. Enter an address from each candidate block here to confirm the boundary before you commit it to a configuration.
Does this calculator handle IPv6?
No — it is IPv4 only, and that is a deliberate scope limit rather than an omission. IPv6 uses the same slash notation over a 128-bit address space, has no broadcast address at all, and comes with its own special-purpose registry and host-counting conventions (a /64 is the standard host subnet regardless of how many devices are on it). Presenting both under the same output labels would mean two contradictory sets of rules on one page.
What is a /32 used for if it holds one address?
Plenty. A /32 is a host route: a single address advertised or configured on its own. Loopback interfaces on routers are conventionally /32 so the address stays up regardless of which physical link is working. Anycast service addresses are advertised as /32 from several locations at once. Firewall rules and access lists use /32 to name exactly one host. The calculator reports 1 total address, 1 usable host, a mask of 255.255.255.255, and no broadcast address.

References& sources.

  1. [1]Fuller, V. & Li, T. (2006). RFC 4632, "Classless Inter-domain Routing (CIDR): The Internet Address Assignment and Aggregation Plan". IETF Best Current Practice 122. Defines slash notation as a four-octet quantity followed by "a decimal value between 0 and 32 that describes the number of significant bits", the equivalence between a prefix and a mask of leading 1-bits, and the deprecation of the Class A/B/C assignment system.
  2. [2]Rekhter, Y. et al. (1996). RFC 1918, "Address Allocation for Private Internets". IETF Best Current Practice 5. Section 3 reserves 10.0.0.0–10.255.255.255 (10/8), 172.16.0.0–172.31.255.255 (172.16/12) and 192.168.0.0–192.168.255.255 (192.168/16) for private use — the three blocks reported by this calculator's address-scope output.
  3. [3]Retana, A., White, R., Fuller, V. & McPherson, D. (2000). RFC 3021, "Using 31-Bit Prefixes on IPv4 Point-to-Point Links". States that with a 31-bit prefix "only two possible addresses may result" and that they "MUST be interpreted as host addresses", and quantifies the saving as two addresses per link instead of four — the basis for this calculator's /31 host count.
  4. [4]Cotton, M., Vegoda, L., Bonica, R. & Haberman, B. (2013). RFC 6890, "Special-Purpose IP Address Registries". Section 2.2.2 is the IANA IPv4 Special-Purpose Address Registry, source of every block name used by the address-scope output: "This host on this network", "Private-Use", "Shared Address Space", "Loopback", "Link Local", "Documentation (TEST-NET-1)", "Benchmarking", "Reserved" and "Limited Broadcast".
  5. [5]Pummill, T. & Manning, B. (1995). RFC 1878, "Variable Length Subnet Table For IPv4". Tabulates every prefix against its dotted-decimal mask and address count — /24 = 255.255.255.0 = 256 addresses, /30 = 255.255.255.252 = 4, /31 = 255.255.255.254 = 2, /32 a single host route — and notes the counts include the network and broadcast addresses.
  6. [6]Postel, J. (1981). RFC 791, "Internet Protocol", DARPA Internet Program Protocol Specification. The base IPv4 specification: 32-bit addresses, an internet header whose "minimum value for a correct header is 5" 32-bit words (20 octets), and a Total Length field allowing datagrams up to 65,535 octets.

In this category

Embed

Quanta Pro

Paid features are coming later.

  • All 590 calculators remain free
  • No billing is enabled
Coming soon