Skip to content

Subnet Calculator (IP / CIDR)

Type an IP address and mask to get the network, broadcast, usable host range and binary view, then split it into subnets, check an address or work with IPv6.

More options
What do you want to do?

You can also type 192.168.1.10/24.

Subnet mask

Split it by
subnets

Separate with commas, spaces or new lines. An address without /n counts as one host (/32).

Short or full form. You can add the prefix, like 2001:db8::/32.

/0–128
prefix
ResultUpdates as you type
Subnets

How your subnet is worked out

Network = IP AND mask. Usable hosts = 2^host bits − 2.

  1. 1

    IP in binary

    192.168.1.10 =11000000.10101000.00000001.00001010

  2. 2

    The /24 mask

    24 ones, 8 zeros= 255.255.255.0

  3. 3

    Network = IP AND mask

    Keep the first 24 bits,set the rest to 0= 192.168.1.0

  4. 4

    Usable hosts

    2^8 − 2 = 254192.168.1.1 –192.168.1.254Broadcast 192.168.1.255

Read more: the formula, a worked example, private ranges and a mask table

An IPv4 address is 32 bits, written as four numbers from 0 to 255. The mask says how many of those bits, counted from the left, name the network; the rest number the hosts (devices) inside it. Writing /24 after an address (CIDR notation) means the first 24 bits are the network.

The formula

network address = IP AND mask
broadcast address = network OR wildcard
wildcard = 255.255.255.255 − mask
addresses = 2^(32 − prefix)
usable hosts = 2^(32 − prefix) − 2 (a /31 has 2, a /32 has 1)
first host = network + 1, last host = broadcast − 1
subnets from borrowing b bits = 2^b

Worked example

Take 192.168.1.10/24. In binary the address is 11000000.10101000.00000001.00001010 and the /24 mask is 24 ones followed by 8 zeros, which is 255.255.255.0. Keeping the first 24 bits and zeroing the last 8 gives the network 192.168.1.0. Setting the last 8 bits to 1 gives the broadcast 192.168.1.255. There are 2^8 = 256 addresses, and 256 − 2 = 254 usable hosts, from 192.168.1.1 to 192.168.1.254. The wildcard mask is 255.255.255.255 − 255.255.255.0 = 0.0.0.255. The first octet, 192, makes it a historic class C address, and it sits in 192.168.0.0/16, a private range (RFC 1918).

Splitting a network

To cut 192.168.1.0/24 into 4 subnets, borrow 2 host bits, because 2^2 = 4. The new prefix is /24 + 2 = /26, each subnet has 2^(32 − 26) = 64 addresses and 62 usable hosts, and they start at .0, .64, .128 and .192. If you need a number that isn't a power of two, round up: 5 subnets need 3 bits, which makes 8.

By hosts it works the other way: 50 hosts plus the network and broadcast addresses need 6 host bits (2^6 = 64), so each subnet is a /26 and a /24 holds 2^(26 − 24) = 4 of them.

VLSM: subnets of different sizes

VLSM sizes each subnet for its own hosts. Sort the needs from biggest to smallest, give each the smallest block that fits, and place them one after another, each starting on a multiple of its own size. In 192.168.1.0/24, needs of 50, 20, 10 and 2 hosts become 192.168.1.0/26, 192.168.1.64/27, 192.168.1.96/28 and 192.168.1.112/30. That uses 116 addresses and leaves 140 free as 192.168.1.116/30, 192.168.1.120/29 and 192.168.1.128/25.

Summarising (supernetting)

A summary route is the smallest single block that covers several networks. Write the lowest and highest addresses in binary and count how many leading bits they share. 192.168.0.0/24 to 192.168.3.0/24 share the first 22 bits, so they summarise to 192.168.0.0/22 with no extra addresses. If there are gaps, the summary also covers addresses you don't own, so the calculator also lists the exact blocks that cover only your networks.

Special IPv4 ranges

BlockWhat it isDefined in
0.0.0.0/8"This network" – not a real destinationRFC 1122
10.0.0.0/8Private networkRFC 1918
100.64.0.0/10Shared address space for carrier-grade NAT (CGNAT)RFC 6598
127.0.0.0/8Loopback – this computerRFC 1122
169.254.0.0/16Link-local – self-assigned when there is no DHCPRFC 3927
172.16.0.0/12Private networkRFC 1918
192.0.0.0/24IETF protocol assignmentsRFC 6890
192.0.2.0/24Documentation and examples (TEST-NET-1)RFC 5737
192.88.99.0/24Old 6to4 relay anycast (deprecated)RFC 7526
192.168.0.0/16Private networkRFC 1918
198.18.0.0/15Network benchmark testingRFC 2544
198.51.100.0/24Documentation and examples (TEST-NET-2)RFC 5737
203.0.113.0/24Documentation and examples (TEST-NET-3)RFC 5737
224.0.0.0/4Multicast (one-to-many)RFC 5771
240.0.0.0/4Reserved for future useRFC 1112
255.255.255.255/32Limited broadcastRFC 919

Every address outside these blocks is a public internet address.

Classes (historic)

Before CIDR arrived in 1993 (RFC 1519), addresses were split into classes by the first octet: A is 0–127 (default /8), B is 128–191 (/16), C is 192–223 (/24), D is 224–239 (multicast) and E is 240–255 (reserved). Routing no longer uses classes, but they still come up in exams and older kit, so the calculator shows the class for reference.

Subnet mask table

PrefixMaskWildcardAddressesUsable hosts
/8255.0.0.00.255.255.25516,777,21616,777,214
/9255.128.0.00.127.255.2558,388,6088,388,606
/10255.192.0.00.63.255.2554,194,3044,194,302
/11255.224.0.00.31.255.2552,097,1522,097,150
/12255.240.0.00.15.255.2551,048,5761,048,574
/13255.248.0.00.7.255.255524,288524,286
/14255.252.0.00.3.255.255262,144262,142
/15255.254.0.00.1.255.255131,072131,070
/16255.255.0.00.0.255.25565,53665,534
/17255.255.128.00.0.127.25532,76832,766
/18255.255.192.00.0.63.25516,38416,382
/19255.255.224.00.0.31.2558,1928,190
/20255.255.240.00.0.15.2554,0964,094
/21255.255.248.00.0.7.2552,0482,046
/22255.255.252.00.0.3.2551,0241,022
/23255.255.254.00.0.1.255512510
/24255.255.255.00.0.0.255256254
/25255.255.255.1280.0.0.127128126
/26255.255.255.1920.0.0.636462
/27255.255.255.2240.0.0.313230
/28255.255.255.2400.0.0.151614
/29255.255.255.2480.0.0.786
/30255.255.255.2520.0.0.342
/31255.255.255.2540.0.0.122
/32255.255.255.2550.0.0.011

IPv6 in short

An IPv6 address is 128 bits, written as 8 groups of 4 hex digits. The short form (RFC 5952) drops leading zeros in each group and replaces the longest run of all-zero groups with ::, once. So 2001:0db8:85a3:0000:0000:8a2e:0370:7334 becomes 2001:db8:85a3::8a2e:370:7334. A normal IPv6 network is a /64; sites often get a /48 or /56, which hold 2^(64 − 48) = 65,536 or 2^(64 − 56) = 256 of them.

BlockWhat it isDefined in
::/128Unspecified addressRFC 4291
::1/128Loopback – this computerRFC 4291
::ffff:0:0/96IPv4-mapped addressRFC 4291
64:ff9b::/96NAT64 well-known prefixRFC 6052
100::/64Discard-onlyRFC 6666
2000::/3Global unicast – public internetRFC 4291
2001::/32Teredo tunnellingRFC 4380
2001:db8::/32Documentation and examplesRFC 3849
2002::/166to4RFC 3056
3fff::/20Documentation and examplesRFC 9637
fc00::/7Unique local address (private)RFC 4193
fe80::/10Link-localRFC 4291
ff00::/8MulticastRFC 4291

Ranges follow the IANA special-purpose address registries (RFC 6890) and the RFCs listed. The calculator works entirely in your browser; nothing you type is sent anywhere.

Common questions

How do I find the network and broadcast address?

Write the IP address and the mask in binary and keep only the bits where the mask has a 1: that is the network address. Set all the host bits (where the mask has a 0) to 1 and you get the broadcast address. For 192.168.1.10/24 the network is 192.168.1.0 and the broadcast is 192.168.1.255.

How many usable hosts are in a /24?

A /24 leaves 8 host bits, so it has 2^8 = 256 addresses. Two are taken by the network and broadcast addresses, leaving 254 usable hosts (192.168.1.1 to 192.168.1.254). In general usable hosts = 2^(32 − prefix) − 2. A /31 is the exception: it has 2 usable addresses for point-to-point links (RFC 3021), and a /32 is a single host.

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

They are opposites. A subnet mask has 1s for the network bits, like 255.255.255.0 for a /24. A wildcard mask flips every bit, so the same network is 0.0.0.255. Routers and firewalls (for example in access lists and OSPF) often ask for the wildcard. Each octet of the wildcard is 255 minus the same octet of the mask.

Which IP addresses are private?

RFC 1918 sets aside three private blocks for home and office networks: 10.0.0.0/8, 172.16.0.0/12 (172.16.0.0 to 172.31.255.255) and 192.168.0.0/16. Internet providers also use 100.64.0.0/10 for carrier-grade NAT (RFC 6598). These addresses are not reachable from the public internet; everything outside the special blocks is public.

What is VLSM?

Variable Length Subnet Masking means cutting one network into subnets of different sizes instead of equal ones. You size each subnet for the hosts it needs, place the biggest first, and keep the rest free. For 192.168.1.0/24, subnets for 50, 20, 10 and 2 hosts become a /26, /27, /28 and /30, using 116 addresses and leaving 140 free.

How many /64 subnets are in an IPv6 /48?

Each bit between the two prefixes doubles the count, so a /48 holds 2^(64 − 48) = 65,536 networks of size /64. A /56 holds 2^(64 − 56) = 256. Every /64 is one normal IPv6 network (LAN) with 2^64 addresses, so IPv6 is planned by counting subnets rather than hosts.

Related calculators

Resistor Color Code CalculatorResistor colour bands to ohms and back for 3, 4, 5 and 6 bands: tolerance range, temperature coefficient, nearest E-series value, SMD codes and series/parallel.Data storage converterMB, GB and TB in decimal (1000) or binary (1024: MiB, GiB, TiB), bits and bytes, why 1 TB shows 931 GB, and download time.Binary & hex converterBinary, octal, decimal and hex (or any base 2–36) both ways with steps, fractions, two’s complement, bitwise maths, text to binary and a clickable bit grid.Scientific calculatorTrig, logs, powers, roots, factorials, nCr and nPr, memory and history, with degrees, radians or gradians and answers as fractions.

Made by Zulu Calculator, part of AlphaZulu LLC. Formulas are shown in full and rule figures are checked against official sources; see how we build calculators.

Embed this calculator on your site

Free to use on your website or blog. Paste this code where you want the calculator to appear. Please keep the credit link.

Subnet Calculator (IP / CIDR) by Zulu Calculator ↗