IP Subnet Calculator (IPv4 CIDR)
Enter an IPv4 address with a prefix such as 192.168.1.10/24, or with a netmask. You get the network and broadcast addresses, the host range and the host count, and can divide it into smaller subnets.
Last reviewed
Network
192.168.1.0/24
254 usable hosts in 256 addresses, a private range (RFC 1918)
- Netmask
- 255.255.255.0
- Wildcard
- 0.0.0.255
- First host
- 192.168.1.1
- Last host
- 192.168.1.254
- Broadcast
- 192.168.1.255
- Address in binary
- 11000000.10101000.00000001.00001010
- Mask in binary
- 11111111.11111111.11111111.00000000
The first address is the network and the last is the broadcast, so they are not given to hosts.
How a subnet is described
An IPv4 address is a 32-bit number, written as four numbers from 0 to 255 separated by dots. A network is a block of consecutive addresses, and CIDR notation (RFC 4632) describes it as an address, a slash and a prefix length: a.b.c.d/n. The prefix length is the number of leading bits that identify the network. The remaining 32 − n bits number the hosts.
For example 192.168.1.10/24 has 24 network bits and 8 host bits.
- Netmask: n ones followed by zeros. For /24 it is 11111111.11111111.11111111.00000000, which is 255.255.255.0.
- Wildcard mask: the netmask with its bits flipped, 0.0.0.255.
- Network address: the address with the host bits set to zero: 192.168.1.0.
- Broadcast address: the address with the host bits set to one: 192.168.1.255.
- Hosts: the addresses between, 192.168.1.1 to 192.168.1.254, which is 2⁸ − 2 = 254 hosts.
The number of hosts
A /n network has 2^(32−n) addresses. The first, the network address, names the network and the last, the broadcast address, reaches every host in it, so the usable hosts are two fewer. Two exceptions follow RFC 3021: a /31 has two addresses and both are hosts on a point-to-point link, with no network or broadcast address, and a /32 is a single host.
| Prefix | Netmask | Addresses | Usable hosts |
|---|---|---|---|
| /8 | 255.0.0.0 | 16777216 | 16777214 |
| /16 | 255.255.0.0 | 65536 | 65534 |
| /20 | 255.255.240.0 | 4096 | 4094 |
| /22 | 255.255.252.0 | 1024 | 1022 |
| /24 | 255.255.255.0 | 256 | 254 |
| /25 | 255.255.255.128 | 128 | 126 |
| /26 | 255.255.255.192 | 64 | 62 |
| /27 | 255.255.255.224 | 32 | 30 |
| /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 |
| /32 | 255.255.255.255 | 1 | 1 |
Worked examples
172.16.5.4/12. The 12 network bits take the second number up to 172.16, with the rest of the second number as host bits. The network is 172.16.0.0, the broadcast is 172.31.255.255, and there are 2²⁰ − 2 = 1,048,574 hosts. This is the private block that RFC 1918 reserves as 172.16.0.0/12.
10.0.0.0/30. Four addresses, 10.0.0.0 to 10.0.0.3. The hosts are 10.0.0.1 and 10.0.0.2, a common size for a link between two routers.
Dividing 192.168.1.0/24 into /26 subnets. The extra two network bits give four subnets of 64 addresses each: 192.168.1.0, 192.168.1.64, 192.168.1.128 and 192.168.1.192.
Private addresses
RFC 1918 sets aside three blocks that are not routed on the public internet: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. The tool says when your address is in one of them.
Common mistakes
- Counting the network and broadcast addresses as hosts. Subtract two, except for /31 and /32.
- Writing a netmask that is not a run of ones. 255.0.255.0 is not a valid mask.
- Typing a leading zero. 192.168.01.1 is ambiguous, because some systems read the 01 as octal. The tool rejects it.
- Mixing up the wildcard and the netmask. They are opposites.
- Assuming the address you typed is the network address. The network address is found by masking the host bits.
For counting in binary and hexadecimal, try the binary calculator and the hex calculator. For data rates on the links, use the bandwidth calculator.
How it is calculated
All of the arithmetic is on unsigned 32-bit integers held as whole numbers, with bitwise AND and OR for the network and broadcast addresses. Subnet lists show at most 64 subnets.
Frequently asked questions
What does 192.168.1.10/24 mean?
The address is 192.168.1.10 and the first 24 of its 32 bits identify the network. The network is 192.168.1.0, the netmask is 255.255.255.0 and the other 8 bits number the hosts, from .1 to .254.
How many hosts are in a subnet?
A /n subnet has 2 to the power of 32 − n addresses. Two are reserved, the network address and the broadcast address, so the usable hosts are 2^(32−n) − 2. A /24 has 256 addresses and 254 hosts.
What is a wildcard mask?
The netmask with every bit flipped. For 255.255.255.0 the wildcard is 0.0.0.255. Router access lists use it to say which bits of an address may vary.
What is special about a /31 or a /32?
RFC 3021 lets a /31 link two devices, using both of its addresses as hosts with no network or broadcast address. A /32 is a single address. The tool reports 2 and 1 usable hosts for them.
Which addresses are private?
RFC 1918 reserves 10.0.0.0 to 10.255.255.255 (10/8), 172.16.0.0 to 172.31.255.255 (172.16/12) and 192.168.0.0 to 192.168.255.255 (192.168/16) for private networks. Routers on the public internet do not forward them.
Does it support IPv6?
No. This calculator is for IPv4, whose addresses are 32 bits long. IPv6 addresses are 128 bits and use a different notation.
Related calculators
- Bandwidth CalculatorChoose what to work out.
- Binary CalculatorEnter two binary numbers and pick an operation.
- Hex CalculatorEnter two hexadecimal numbers and pick an operation.
- Cron Expression GeneratorFill in the minute, hour, day of month, month and day of week, or start from a common schedule.
- Base64 Encoder and DecoderType or paste text to encode it as base64, or paste base64 to decode it.
- Epoch and Unix Timestamp ConverterEnter a Unix timestamp to see the date, or enter a date and time to get the timestamp.