Skip to content
Plaintools

Subnet calculator

Enter an IPv4 address and CIDR prefix length (or standard subnet mask) to calculate network boundaries, broadcast addresses, usable host ranges, and wildcard masks. Includes bit breakdown and quick prefix reference. All math runs entirely in this browser tab without network requests.

Runs locally in your browser · No network requests

Presets:

Supports standard IPv4 or CIDR format like 10.0.0.1/24

/

/24 (255.255.255.0)

Quick Prefix Slider:/24 (255.255.255.0)
/0 (Internet)/8 (Class A)/16 (Class B)/24 (Class C)/32 (Host)

Calculation Results

Network Address

192.168.1.0

/24

Subnet Mask

255.255.255.0

Wildcard: 0.0.0.255

Usable Hosts

254

Total: 256

Broadcast Address

192.168.1.255

Scope: Private

Network & Addressing Specification

Usable Host Range
192.168.1.1 – 192.168.1.254
First Usable Host
192.168.1.1
Last Usable Host
192.168.1.254
CIDR Notation
192.168.1.0/24
IP Classification
Class C · Private (RFC 1918)
Hex Representation
IP: 0xc0a80132 · Mask: 0xffffff00

Binary Bit Breakdown

IP Address:11000000.10101000.00000001.00110010
Subnet Mask:11111111.11111111.11111111.00000000
Network ID:11000000.10101000.00000001.00000000
Broadcast:11000000.10101000.00000001.11111111

Subnet mask has 24 network bits and 8 host bits.

Common IPv4 CIDR Reference Table

CIDRSubnet MaskUsable HostsCommon UsageAction
/8255.0.0.016,777,214Class A (/8)
/16255.255.0.065,534Class B (/16)
/20255.255.240.04,094Large Office (/20)
/22255.255.252.01,022Medium Office (/22)
/24255.255.255.0254Class C / Standard LAN (/24)
/25255.255.255.128126Half Subnet (/25)
/26255.255.255.19262Quarter Subnet (/26)
/27255.255.255.2243032-IP Block (/27)
/28255.255.255.2401416-IP Block (/28)
/29255.255.255.2486Small Subnet (/29)
/30255.255.255.2522Legacy Point-to-Point (/30)
/31255.255.255.2542Modern Point-to-Point (/31)
/32255.255.255.2551Host Route (/32)

Subnet calculator example

Standard Class C LAN (/24)

192.168.1.50/24 produces network address 192.168.1.0, netmask 255.255.255.0, broadcast 192.168.1.255, usable host range 192.168.1.1 through 192.168.1.254, and 254 usable hosts.

Subnet calculator how-to

  1. Parse IPv4 octets into 32-bit unsigned integer ipInt = (o1<<24) | (o2<<16) | (o3<<8) | o4.
  2. Parse prefix (0..32) or derive from contiguous mask bits.
  3. Compute maskInt = prefix === 0 ? 0 : (0xffffffff << (32 - prefix)) >>> 0; wildcardInt = (~maskInt) >>> 0.
  4. Compute networkInt = (ipInt & maskInt) >>> 0 and broadcastInt = (networkInt | wildcardInt) >>> 0.
  5. Total hosts = 2^(32 - prefix). For /32: 1 usable host (itself). For /31 (RFC 3021): 2 usable hosts. Otherwise: max(0, totalHosts - 2).
  6. First usable = networkInt + 1; Last usable = broadcastInt - 1. Format as dotted-decimal octets.

Related tools

Dev

JWT decoder

Read a JWT header and payload, with human timestamps and an expired flag. The token stays in the tab.

Dev

Hash generator

Calculate SHA-256, SHA-384, SHA-512, and SHA-1 checksums for text or local files.

Dev

Timestamp converter

Convert Unix epoch timestamps in seconds or milliseconds to ISO 8601, UTC, and local time.

Dev

CIDR calculator

Calculate IPv4 CIDR blocks, network address, broadcast address, netmask, usable hosts, and wildcard mask.

People also use

Dev

Text diff checker

Compare two texts with a live line and word diff. Optional ignore-whitespace.

Dev

CSV to JSON converter

Convert CSV records to a JSON array of objects with header mapping and type detection.

Subnet calculator FAQ

What's the difference between a subnet calculator and a CIDR calculator?
CIDR notation is the /prefix form of a subnet mask, such as /24 for 255.255.255.0. This tool takes either an IPv4 address in CIDR notation or a prefix length and shows the network address, broadcast address, usable host range, and host count. It runs locally in your browser, and nothing is uploaded.
Does this subnet calculator send my IP addresses to a server?
No. All IP parsing and subnet bitwise arithmetic execute locally in JavaScript inside your browser. No IP addresses, subnets, or network topologies are ever transmitted or logged.
What is CIDR notation?
Classless Inter-Domain Routing (CIDR) notation expresses an IP address and its associated routing prefix length using a forward slash followed by the count of leading 1 bits in the subnet mask (e.g. /24 equals 255.255.255.0).
How are usable host addresses determined?
For standard subnets (/0 to /30), the first address is the Network Address and the last address is the Broadcast Address, leaving 2^(32 - prefix) - 2 usable host addresses. For point-to-point links (/31 under RFC 3021), both addresses are usable hosts. For /32 host routes, 1 host is addressable.
What is a wildcard mask?
A wildcard mask is the bitwise inverse of a subnet mask (255.255.255.255 - subnet mask). It is commonly used in Cisco IOS Access Control Lists (ACLs) and Open Shortest Path First (OSPF) network configurations.
How do I calculate an IPv4 subnet without this page?
Convert the 4 octets to a 32-bit integer: ipInt = (o1 << 24) | (o2 << 16) | (o3 << 8) | o4. For prefix n (0..32), maskInt = n === 0 ? 0 : (0xffffffff << (32 - n)) >>> 0. Wildcard mask = (~maskInt) >>> 0. Network address = (ipInt & maskInt) >>> 0. Broadcast address = (networkInt | wildcardInt) >>> 0. Total hosts = 2^(32 - n). Usable hosts = n === 32 ? 1 : n === 31 ? 2 : Math.max(0, totalHosts - 2). First usable = networkInt + 1; last usable = broadcastInt - 1. Format each 32-bit int as octets: (int >>> 24) & 255, (int >>> 16) & 255, (int >>> 8) & 255, int & 255.