Subnet Calculator
Calculate subnet masks and ranges.
About this tool
Enter an IPv4 address with its prefix length to see the subnet mask, network address, broadcast address, first and last usable host and host count. Use it when planning subnets or checking a mask like 255.255.255.240.
How to use
How it works
The prefix length gives the mask: /24 is 255.255.255.0 and /28 is 255.255.255.240. Block size equals 2^(32 − prefix), and subnets start on multiples of that size. For /24, the network is.0, the broadcast is.255 and hosts run.1 to.254.
mask = (2^32 − 2^(32 − prefix)); block size = 2^(32 − prefix)
Worked example
A standard /24
- Input
- 192.168.1.0/24
- Output
- { "network": "192.168.1.0", "prefix": 24, "mask": "255.255.255.0", "broadcast": "192.168.1.255", "firstHost": "192.168.1.1", "lastHost": "192.168.1.254", "hostCount": 254 }
- Walkthrough
- The /24 block has 256 addresses; removing the network and broadcast leaves 254 usable.
Limitations
- IPv4 only. It does not split a network into smaller subnets automatically.
- Input must be IP/prefix; a bare mask like 255.255.255.0 is not accepted.
- A /32 shows hostCount 2 even though it is a single address.
Questions
How do I calculate a subnet mask?
How many hosts in a /26?
What is the broadcast address of 10.0.0.0/24?
Can I enter the mask instead of a prefix?
Features
- Mask and range
- Host count
- Runs in your browser
Related resources
Guides and videos from around the web—opens on YouTube or the publisher’s site.
How base64 encoding works
Andrew Schmelyun
Mental model for Base64 encode/decode tools.
Watch on YouTubeLearn JSON - Full Crash Course
freeCodeCamp.org
JSON is the payload format behind many developer tools here.
Watch on YouTube
- MDN Web Docs
MDN
Primary reference for web APIs these developer tools touch.
- Introducing JSON
json.org
Canonical JSON grammar for formatters and validators.