IP Subnet Calculator

ai generated 8211245 640

Binary / Decimal IPv4 Subnet Calculator

A fast, client-side IPv4 subnet calculator for network engineers and students. Enter an IP in binary (32 bits) or dotted-decimal (e.g., 192.168.0.1) and a mask as CIDR prefix (0–32), binary mask, or dotted mask (e.g., 255.255.255.0). The tool converts binary to dotted IP, validates contiguous masks, and returns subnet mask, CIDR, network/broadcast, first/last usable, usable host count, wildcard mask, and class/scope. Includes a lightweight VLSM planner for quick address-plan sketches. Ideal for lab work, troubleshooting, and CCNA prep.

How to use
• IP: binary (32 bits) or dotted-decimal
• Mask: prefix (/24 → 24), binary mask, or dotted mask
• Click Calculate → copy results for documentation or tickets

Binary / Decimal IPv4 Subnet Calculator

Enter IPv4 as binary (32 bits; spaces OK) or dotted-decimal (e.g., 192.168.0.1).
Mask can be prefix (0–32), binary (32 bits), or dotted (e.g., 255.255.255.0).
Tip: You may also type a combined value in the IP field, e.g. 192.168.0.1/24 or 192.168.0.1 , 24.

IP (dotted):
Subnet mask:
CIDR prefix:
Network address:
Broadcast address:
First host:
Last host:
Usable hosts:
Wildcard mask:
Class / scope:
Binary breakdown (IP & mask)

What this binary / decimal ipv4 subnet calculator does

This calculator converts binary IPv4 (32 bits) or dotted-decimal IPv4 (e.g., 192.168.0.1) into a complete subnet breakdown. It accepts masks as CIDR prefix (0–32), binary mask, or dotted mask (e.g., 255.255.255.0). For each input it returns the dotted IP, subnet mask, CIDR, network address, broadcast address, first/last usable hosts, usable host count, wildcard mask, and class/scope (public, private, loopback, link-local). A compact binary breakdown helps verify each octet at a glance, and the optional VLSM planner allocates variable-length subnets within a base network.

Why network engineers use it

Subnetting is routine in design, implementation, and troubleshooting. This tool accelerates common tasks:

  • quick binary ↔ dotted verification when reading lab tasks or RFC examples

  • validating contiguous masks and CIDR alignment during config reviews

  • checking usable ranges and broadcast behavior for incident tickets

  • fast address planning with VLSM for campus and branch topologies

  • exam practice for certifications (e.g., CCNA, Network+) without external dependencies

Everything runs client-side—no external scripts, no APIs, no data sent anywhere—so it’s safe for sensitive lab material or offline documentation.

Supported inputs and outputs

Accepted IP formats

  • 32-bit binary: 11000000 10101000 00000000 00000001

  • dotted-decimal: 192.168.0.1

Accepted mask formats

  • CIDR prefix: 0–32 (e.g., 24)

  • binary mask: 11111111 11111111 11111111 00000000

  • dotted mask: 255.255.255.0

Calculated output

  • dotted IP and binary view

  • dotted subnet mask and binary view

  • CIDR prefix (/n)

  • network address and broadcast address

  • first and last usable host

  • number of usable hosts

  • wildcard mask (mask inverse)

  • address class and scope (public/private/loopback/link-local)

Quick refresher on ipv4 math and cidr

An IPv4 address has 32 bits, split into four 8-bit octets. CIDR expresses the mask as the count of leading 1s. For example:

  • /24 → mask 255.255.255.0 → binary 11111111 11111111 11111111 00000000

  • /26 → mask 255.255.255.192 → binary 11111111 11111111 11111111 11000000

From any IP and mask:

  • network = IP AND mask

  • broadcast = network OR (mask bitwise NOT)

  • usable hosts =

    • /32: 1 (host route)

    • /31: 2 (point-to-point)

    • otherwise: 2^(32−prefix) − 2

A wildcard mask is the inverse of the subnet mask and is commonly used in router ACLs.

Worked examples

Example 1: dotted ip + prefix

Input

  • IP: 192.168.0.1

  • Prefix: 24

Output

  • subnet mask: 255.255.255.0 (11111111 11111111 11111111 00000000)

  • network: 192.168.0.0

  • broadcast: 192.168.0.255

  • first / last host: 192.168.0.1192.168.0.254

  • usable hosts: 254

  • wildcard: 0.0.0.255

  • class / scope: C; private

Example 2: binary ip + dotted mask

Input

  • IP (binary): 11000000 10101000 00000001 00000101

  • Mask (dotted): 255.255.255.192

Output

  • dotted IP: 192.168.1.5

  • prefix: /26

  • network: 192.168.1.0

  • broadcast: 192.168.1.63

  • first / last host: 192.168.1.1192.168.1.62

  • usable hosts: 62

  • wildcard: 0.0.0.63

  • class / scope: C; private

Example 3: point-to-point /31

Input

  • IP: 10.0.0.8

  • Prefix: 31

Output

  • network: 10.0.0.8

  • broadcast: 10.0.0.9

  • usable: 2 (both addresses)

  • note: /31 is valid for point-to-point links; there is no traditional “all-hosts” broadcast within the pair.

Example 4: host route /32

Input

  • IP: 172.16.10.25

  • Prefix: 32

Output

  • network = host = 172.16.10.25

  • usable: 1 (the address itself)

  • typical use: loopbacks, device identifiers, routing lookups

Validations and edge cases

  • masks must be contiguous (all 1s followed by 0s). Non-contiguous masks are rejected to prevent undefined behavior.

  • ranges: octets must be 0–255; prefixes 0–32.

  • special scopes are highlighted:

    • 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 → private

    • 127.0.0.0/8 → loopback

    • 169.254.0.0/16 → link-local (APIPA)

How the vlsm planner helps

The built-in VLSM subnet planner takes a base network (e.g., 192.168.10.0/24) and a list of required host counts (e.g., 80, 20, 12, 5). It sorts demands from largest to smallest, finds the smallest prefix that satisfies each demand (respecting /31 and /32 semantics), then places each subnet on the next aligned boundary within the base block. The output includes:

  • assigned prefix per requirement

  • usable capacity vs. requested hosts

  • network, first/last host, broadcast

  • waste (unused addresses) to guide optimization

This approach mirrors real-world design workflows where you pack variable-size LANs into a parent block with minimal fragmentation.

Practical workflows

  • during design reviews, paste proposed IPs and masks to confirm boundaries, broadcast, and usable ranges.

  • when troubleshooting, verify whether an address actually belongs to a subnet and check /31 behavior on WAN links.

  • in lab documentation, use the copy button to capture all calculated fields for change tickets or runbooks.

  • for ACLs, read the wildcard mask directly—no extra conversion step required.

  • in training, flip between binary and dotted to reinforce bit-level understanding.

Troubleshooting common inputs

  • ip rejected as invalid
    Ensure four octets in 0–255, or exactly 32 bits if using binary. Mixed formats (e.g., dotted IP with a binary octet) are not accepted.

  • mask rejected as invalid
    Check for a proper CIDR prefix (0–32), or use a contiguous binary/dotted mask. Non-contiguous masks (e.g., 255.0.255.0) are not valid for standard subnetting.

  • unexpected usable host count
    Remember the special rules:
    /32 → 1 usable; /31 → 2 usable; otherwise 2^(32−prefix) − 2.

  • address scope seems wrong
    Private ranges are strictly defined. For example, 172.31.255.255 is private, but 172.32.0.1 is not.

Faq

What is cidr and why does it matter?
CIDR (classless inter-domain routing) uses a prefix (/n) to describe how many leading bits are network bits. It enables flexible subnet sizes beyond classful A/B/C boundaries.

Why do some subnets have no broadcast?
On /31, both addresses are usable on point-to-point links; there’s no traditional all-hosts broadcast. This saves addresses on WAN links.

How is the wildcard mask derived?
It’s the bitwise inverse of the subnet mask. Example: 255.255.255.00.0.0.255. Many ACLs match traffic using wildcards instead of masks.

Can I enter a dotted mask instead of a prefix?
Yes. The tool accepts prefix, binary mask, or dotted mask and validates contiguity automatically.

Is ipv6 supported?
This page focuses on IPv4 for clarity and speed. If you need IPv6 subnetting, run a separate dedicated tool to avoid mixing address families.

This binary / decimal IPv4 subnet calculator is a single-page, client-side utility that turns raw addresses into a precise, audit-ready subnet summary. It validates masks, handles /31 and /32 correctly, surfaces wildcard masks for ACL work, and includes a practical VLSM planner for day-to-day address design. Use it for lab practice, configuration reviews, incident triage, and documentation—fast, accurate, and API-free.



Image(s) used in this article are either AI-generated or sourced from royalty-free platforms like Pixabay or Pexels.

Did you enjoy this article? Buy me a coffee!

Buy Me A Coffee
Top