Skip to content

IP Subnet Calculator (IPv4 CIDR)

IPv4 CIDR calculator: network, broadcast, host range, mask, wildcard, private ranges, and splitting a network into subnets.

Your details

You can also type CIDR notation such as 10.0.0.0/30; the /n then overrides the prefix below.

Network size given as
bits

Number of equal subnets you need; it is rounded up to a power of 2.

Results update as you type

Network (CIDR)

192.168.1.0/24

Usable hosts
254
First host
192.168.1.1
Last host
192.168.1.254
Broadcast address
192.168.1.255
Total addresses
256
Subnet mask
255.255.255.0 (/24)
Wildcard mask
0.0.0.255
Address in binary
11000000.10101000.00000001.00001010
Mask in binary
11111111.11111111.11111111.00000000
Historic class
C
Address type
private network (192.168.0.0/16, RFC 1918)

192.168.1.10 is a host address; its network is 192.168.1.0/24.

Class C by its first octet (historic classful addressing; routing uses CIDR since 1993).

Step-by-step solution
  1. Network = address AND mask (bit by bit):
  2. 11000000.10101000.00000001.00001010 (192.168.1.10)
  3. ∧ 11111111.11111111.11111111.00000000 (255.255.255.0)
  4. = 11000000.10101000.00000001.00000000 (192.168.1.0)
  5. Broadcast = network OR wildcard (inverted mask) = 192.168.1.255
  6. Hosts = 2^(32 − 24) − 2 = 256 − 2 = 254

Planning a LAN, writing a firewall rule or studying for a networking exam all come down to the same question: which addresses belong to this subnet? Enter an IPv4 address with a prefix length (/24) or a subnet mask (255.255.255.0) and this calculator returns the network address, the broadcast address, the first and last usable host, the number of hosts, the wildcard mask used in router access lists, and a binary view that shows exactly where the network bits end.

It also tells you what kind of address you typed: a private RFC 1918 range, the RFC 6598 shared space used by carrier-grade NAT, loopback, link-local, multicast, documentation or ordinary public space.

Need several smaller networks? Enter how many subnets you want and the calculator borrows the right number of bits and lists each subnet with its host range.

How to use this calculator

  1. Type the IPv4 address, for example 192.168.1.10. You can paste CIDR notation directly (10.0.0.0/30).
  2. Give the network size either as a prefix length (/0 to /32) or as a subnet mask. Masks must be contiguous: 255.255.255.0 is valid, 255.0.255.0 is not.
  3. Optionally enter the number of subnets you want to carve out of this block.
  4. Read the network in CIDR form, the host range, the broadcast address, the counts and the binary breakdown. Open the steps to see the bitwise AND.

The formula

An IPv4 address is a 32-bit number. A prefix length nn sets the first nn bits of the mask to 1:

mask=232−232−n\text{mask} = 2^{32} - 2^{32-n}
network=address∧maskbroadcast=network∨¬ mask\text{network} = \text{address} \land \text{mask} \qquad \text{broadcast} = \text{network} \lor \lnot\,\text{mask}

The block contains 232−n2^{32-n} addresses. The first (network) and last (broadcast) are reserved, so

usable hosts=232−n−2(n≤30)\text{usable hosts} = 2^{32-n} - 2 \quad (n \le 30)

Two exceptions: a /31 has two usable addresses on point-to-point links (RFC 3021), and a /32 designates a single host. Splitting into kk equal subnets adds ⌈log⁡2k⌉\lceil \log_2 k \rceil bits to the prefix.

Worked example

192.168.1.10/24. The mask 255.255.255.0 keeps the first three octets, so the network is 192.168.1.0 and the broadcast 192.168.1.255. Hosts run from 192.168.1.1 to 192.168.1.254: 28−2=2542^{8} - 2 = 254 usable addresses. The address sits in 192.168.0.0/16, a private RFC 1918 range.

10.0.0.0/30, the classic router-to-router link: four addresses, 2 usable hosts (10.0.0.1 – 10.0.0.2), broadcast 10.0.0.3.

Splitting 192.168.1.0/24 into 4 subnets borrows 2 bits, giving /26 networks of 62 hosts each: 192.168.1.0, 192.168.1.64, 192.168.1.128 and 192.168.1.192.

Common prefix lengths

Prefix Mask Addresses Usable hosts
/8 255.0.0.0 16,777,216 16,777,214
/16 255.255.0.0 65,536 65,534
/22 255.255.252.0 1,024 1,022
/24 255.255.255.0 256 254
/26 255.255.255.192 64 62
/28 255.255.255.240 16 14
/29 255.255.255.248 8 6
/30 255.255.255.252 4 2
/31 255.255.255.254 2 2 (RFC 3021)
/32 255.255.255.255 1 1

Private and special IPv4 ranges

RFC 1918 reserves 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 for private networks; they are never routed on the Internet and reach it through NAT. RFC 6598 sets aside 100.64.0.0/10 for carrier-grade NAT between an operator and its customers. 127.0.0.0/8 is loopback, 169.254.0.0/16 is link-local (the address a computer gives itself when DHCP fails), 224.0.0.0/4 is multicast and 240.0.0.0/4 is reserved. Three /24 blocks (192.0.2.0, 198.51.100.0 and 203.0.113.0) exist only for documentation and examples. The full list is maintained by IANA under RFC 6890.

Classes, CIDR and IPv6

Before 1993, the first bits of an address fixed its class: A (/8), B (/16) or C (/24). CIDR (RFC 4632) replaced this with prefixes of any length, so the class shown here is informative only. IPv6 works on the same principle with 128-bit addresses; a typical LAN is a /64, which holds 2642^{64} addresses, and there is no broadcast address. This calculator covers IPv4 only.

Frequently asked questions

How many hosts are in a /24?

A /24 holds 256 addresses. Removing the network and broadcast addresses leaves 254 usable hosts, for example 192.168.1.1 to 192.168.1.254.

What is the difference between a subnet mask and a wildcard mask?

The wildcard is the bitwise inverse of the mask: 255.255.255.0 becomes 0.0.0.255. Router access lists and OSPF configurations use wildcards to say which bits may vary.

Can I use a /31 network?

Yes, on point-to-point links. RFC 3021 lets both addresses of a /31 be used as host addresses, saving two addresses per link compared with a /30. There is no broadcast address in a /31.

How do I split a network into subnets?

Borrow host bits: each extra bit doubles the number of subnets and halves their size. For 4 subnets, add 2 bits; for 6, add 3 bits (8 subnets), since the count must be a power of 2. Enter the number in the split field to get the list.

Is my address private or public?

If it falls in 10.0.0.0/8, 172.16.0.0/12 or 192.168.0.0/16 it is private (RFC 1918); 100.64.0.0/10 is carrier-grade NAT space. The Address type output tells you which special block, if any, contains it.

Sources

Last updated:

More Other calculators

People also use