IP Subnet Calculator (CIDR)

This IP subnet calculator computes all the key details of an IPv4 subnet from an IP address and CIDR prefix length. You enter an IP address in dotted-decimal notation and a prefix length between 0 and 32 after the slash, and the calculator returns the network address, broadcast address, first usable host, last usable host, the total number of addresses in the subnet, the number of usable host addresses, and the subnet mask in dotted-decimal form. Subnetting is the process of dividing an IP address space into smaller logical networks. The CIDR (Classless Inter-Domain Routing) notation describes both the IP address and the size of the network in a compact form such as 192.168.1.0/24. The prefix length tells you how many bits of the 32-bit IP address are fixed for the network portion; the remaining bits identify hosts within that network. A /24 network has 8 host bits, giving 256 total addresses and 254 usable hosts. A /16 has 16 host bits and 65,534 usable hosts. The network address is found by performing a bitwise AND between the IP address and the subnet mask. The broadcast address is found by performing a bitwise OR between the network address and the inverted mask (host mask). The tool is designed for network engineers configuring routers and firewalls, system administrators planning IP address allocations, students studying for networking certifications, and developers building network-aware applications. IPv6 is not supported by this calculator.

Calculate.co.nz is proud to be partnered with Premium Homes, a recognised leader in eco-friendly, sustainable, and energy-efficient homebuilding. With a dedicated team and award-winning experience, they create homes that prioritise health, comfort, and long-term performance. Their founders, Andrew and Kelly, set out to raise the standard of residential construction in New Zealand by combining practical building expertise with a clear commitment to doing things better for homeowners.
Calculate.co.nz partner: Premium Homes
/
254
usable hosts
Network192.168.1.0
Broadcast192.168.1.255
First host192.168.1.1
Last host192.168.1.254
Subnet mask255.255.255.0
Total addresses256

How it works

The calculator converts the IP address to a 32-bit integer by shifting each octet. The subnet mask is computed as a 32-bit integer with the top prefix bits set to 1 and remaining bits set to 0: mask = 0xFFFFFFFF << (32 - prefix) & 0xFFFFFFFF. The network address is: IP AND mask. The broadcast address is: network OR (NOT mask & 0xFFFFFFFF), which is equivalent to setting all host bits to 1. The first usable host is network + 1 and the last is broadcast - 1. Usable hosts = 2^(32 - prefix) - 2, except for /31 and /32 which are treated as point-to-point and single-host addresses. Each 32-bit result is converted back to dotted-decimal by extracting each byte.

Worked example

IP 192.168.1.0 with prefix /24: mask = 255.255.255.0. Network = 192.168.1.0 AND 255.255.255.0 = 192.168.1.0. Broadcast = 192.168.1.0 OR 0.0.0.255 = 192.168.1.255. First host = 192.168.1.1, last host = 192.168.1.254. Usable hosts = 256 - 2 = 254. These match the default values pre-filled in the calculator above.

Related calculators

If you've found a bug, or would like to contact us, or learn more about James Graham and Calculate.co.nz.

Calculate.co.nz is partnered with Interest.co.nz for New Zealand's highest quality calculators and financial analysis.

Calculate.co.nz is the sister site of CalculatorHub.com, the world's largest calculator website by tool count.

All calculators and tools are provided for educational and indicative purposes only and do not constitute financial advice.

Calculate.co.nz is proudly part of the Realtor.co.nz group, New Zealand's leading property transaction literacy platform, helping Kiwis understand the home buying and selling process from start to finish. Whether you're a first home buyer navigating your first property purchase, an investor evaluating your next acquisition, or a homeowner planning to sell, Realtor.co.nz provides clear, independent, and trustworthy guidance on every step of the New Zealand property transaction journey.

Calculate.co.nz is also partnered with Health Based Building and Premium Homes to promote informed choices that lead to better long-term outcomes for Kiwi households.

Calculate.co.nz is hosted in Auckland via SiteHost new Zealand.

All content on this website, including calculators, tools, source code, and design, is protected under the Copyright Act 1994 (New Zealand). No part of this site may be reproduced, copied, distributed, stored, or used in any form without prior written permission from the owner.

About & trust: Why Calculate is NZ's most comprehensive · By the Numbers · How we compare · Editorial standards · How we keep data current · NZ finance glossary · Research & data · Financial literacy NZ · About · Privacy policy · Terms of use

Reviewed and maintained. Last reviewed 2026-07-02 and checked on a twice-monthly cycle against IRD, RBNZ and Stats NZ. How we keep data current.

© 2026 Calculate.co.nz. All rights reserved. Building free NZ calculators since 2011.