Subnet Mask to Binary Calculator for IPv4

May 2, 2026

Subnet Mask to Binary Calculator

Convert dotted masks, CIDR prefixes, and host ranges into a clean binary breakdown for home labs, VLANs, and small network plans.

📋 Presets

🔧 Calculator Inputs

Used to derive network, broadcast, and host range.
Pick how the subnet mask entry should be read.
Accepts dotted decimal, slash notation, or 32-bit groups.
Serves as a direct prefix override when supplied.
Used to estimate the smallest prefix that still fits.
Used to estimate the borrowed-bit requirement.
Adds spare headroom before the host-fit prefix is chosen.
Controls the default class boundary used for subnet math.
Legacy mode removes one subnet when bits are borrowed.
Controls the recommended-fit summary shown in the results.
Changes the emphasis of the top result cards.
Live IPv4 conversion
Ready to convert the current subnet mask input.
Binary, prefix, host, and range details update together.
Binary view
Binary Mask
11111111.11111111.11111111.00000000
32 bits across 4 octets
Mask bits are counted from left to right.
Host Capacity
254
usable hosts
Classic and RFC-aware counts are both tracked.
Wildcard / Block
0.0.0.255
block size 256
Wildcard bits are the inverse of the mask.
Fit Check
/26
host-first
Subnet fit /26, host fit /26.

📊 Full Breakdown

📑 Reference Tables

Prefix Mask Binary Usable Hosts
/24255.255.255.011111111.11111111.11111111.00000000254
/25255.255.255.12811111111.11111111.11111111.10000000126
/26255.255.255.19211111111.11111111.11111111.1100000062
/27255.255.255.22411111111.11111111.11111111.1110000030
/28255.255.255.24011111111.11111111.11111111.1111000014
/29255.255.255.24811111111.11111111.11111111.111110006
/30255.255.255.25211111111.11111111.11111111.111111002
/31255.255.255.25411111111.11111111.11111111.111111102
Bit Decimal Binary Role
112810000000Octet start
26401000000Half split
33200100000Smaller block
41600010000Mid block
5800001000Small block
6400000100Tiny block
7200000010P2P block
8100000001Last bit
Class Range Default Mask Typical Use
A1-126255.0.0.0Large LANs
B128-191255.255.0.0Mid networks
C192-223255.255.255.0Small LANs
Other224-255VariesSpecial use
Hosts Need Prefix Mask Block
2/30255.255.255.2524
6/29255.255.255.2488
14/28255.255.255.24016
30/27255.255.255.22432
62/26255.255.255.19264
126/25255.255.255.128128
254/24255.255.255.0256
510/23255.255.254.0512

🛠 Equipment / Spec Grid

Gateway Router
1-8
Ports at the LAN edge, where mask changes meet NAT and routing.
Managed Switch
8-48
VLAN trunk space that often maps one subnet to one broadcast domain.
Firewall Appliance
2-8
Policy boundary for DMZ, guest, and lab prefixes.
Test Host / VM
1-2
A small lab node for validating /31, /30, or /24 ranges.

💡 Tip Boxes

Tip: Match the mask and prefix before you trust any host count.

Tip: Treat /31 and /32 as special cases when checking usable addresses.

A subnet mask are used to determine where the network portion of an IP address end and the host portion begins. Additionally, a subnet mask is used to define how many address can be used for devices on the network. A subnet mask can be wrote in dotted decimal notation, such as 255.255.255.0, or in CIDR notation, such as /24.

A subnet mask use binary digits to separate the network portion of an IP address from the host portion of an IP address. The subnet mask informs the router which portion of an IP address is for the network and which portion of the IP address is for the host on the network. A subnet mask consist of several octet.

What is a subnet mask

Each octet contains eight bit. A bit value of one in a subnet mask indicate that the bit is part of the network portion of an IP address. A bit value of zero in a subnet mask indicate that the bit is part of the host portion of an IP address.

For example, a /24 mask has twenty-four bits that contain a value of one and eight bit that contain a value of zero. Therefore, a /24 subnet mask create a twenty-four bit network portion for IP addresses. A /24 mask has eight zero in its host portion, which allow for 256 IP addresses on the network.

However, one address is used for the network address, and another address is used for the broadcast address. Therefore, a /24 mask allows for 254 IP addresses for host on a network. Altering the number of zero in the subnet mask can change the number of host that can be on a network.

For instence, using a /25 mask instead of a /24 mask will increase the number of one in the mask and decrease the number of zero in the mask. A /25 mask will only allow for 128 total address for a network. Therefore, a /25 mask will only allow for 126 address for hosts on the network.

If the network administrator decrease the number of zero in the subnet mask, the number of available host on the network will decrease. However, the number of subnet created by the network will increase. Subnets allow network to be segmented into smaller network.

Additionally, different type of traffic can be organized into a network into separate subnet for management. People often make mistake when using subnet masks. Subnet mask math can be difficult to calculate in ones head.

Many people will make a mistake with the number of host that can be on a network if they dont subtract the one address for the network and the one address for the broadcast address. They may also choose a mask that provides too many address for the number of device that will be on the network. Using a /23 mask for a network with only 200 device will waste many of the IP addresses that can be used on the network.

Using a subnet mask calculator can avoid these mistake. A subnet mask calculator can calculate the binary representation of the mask. Additionally, a subnet mask calculator can calculate the total number of usable host address on the network.

Before applying a subnet mask to a network, it is important to ensure that the network has the appropriately requirements for the number of device on the network. Additionally, it is important to ensure that there is enough address in the subnet mask to accommodate those device and to accommodate future growth in the number of device on the network. When a administrator apply subnet mask correctly to networks, the network can be properly organize, and the IP addresses can be efficient utilized.

Subnet Mask to Binary Calculator for IPv4

Related posts

Leave a Comment