Broadcast Address Calculator: CIDR, Wildcard and Magic Number

Broadcast Address Calculator

Find the IPv4 broadcast address by OR-ing the network address with the wildcard mask. Enter an IP with a CIDR prefix or a dotted mask and this tool returns the broadcast, the wildcard used, the last usable host, and the magic-number interval found as 256 minus the interesting mask octet.

📡Mask Entry Mode

🎯Real Network Presets

📝IP and Mask Inputs

Any host inside the subnet works; the broadcast does not depend on which host you type.

Prefix bits set to 1 in the mask; the rest are host bits.

Must be contiguous ones then zeros, for example 255.255.255.192.

Adds binary lines for IP, mask, wildcard, and broadcast.

The block size in the interesting octet equals 256 minus that mask octet.

Broadcast Address 0.0.0.0 network OR wildcard
Wildcard Mask Used 0.0.0.0 inverse of the subnet mask
Last Usable Host 0.0.0.0 broadcast minus one
Magic Number / Interval 0 256 minus interesting octet

🔢Broadcast Snapshot

ORnet or wildcard
~maskwildcard
-1last host
256-mblock size

📋Worked Network-OR-Wildcard Example

StepOperationValue (dotted)Result
1Host IP192.168.1.10Any host in block
2Subnet mask /26255.255.255.19226 network bits
3Wildcard = NOT mask0.0.0.636 host bits
4Network = IP AND mask192.168.1.0Block start
5Broadcast = net OR wildcard192.168.1.63Block end
6Last host = broadcast - 1192.168.1.62Highest usable

📊Magic Number Table (256 minus Mask Octet)

Mask OctetBlock Size (256 - octet)Prefix in OctetHost BitsBlocks in Octet
0256/24 boundary81
128128/2572
19264/2664
22432/2758
24016/28416
2488/29332
2524/30264
2542/311128
2551/320256

📡Broadcast per Common Prefix on a /24

PrefixSubnet (192.168.1.x)BroadcastUsable RangeHosts
/24192.168.1.0192.168.1.255.1 - .254254
/25192.168.1.0192.168.1.127.1 - .126126
/25192.168.1.128192.168.1.255.129 - .254126
/26192.168.1.0192.168.1.63.1 - .6262
/26192.168.1.64192.168.1.127.65 - .12662
/27192.168.1.32192.168.1.63.33 - .6230
/28192.168.1.16192.168.1.31.17 - .3014
/29192.168.1.8192.168.1.15.9 - .146
/30192.168.1.4192.168.1.7.5 - .62

🗃Prefix Comparison Grid (on 192.168.1.0)

PrefixSubnet MaskWildcardBlock SizeBroadcastLast Host
/24255.255.255.00.0.0.255256192.168.1.255192.168.1.254
/25255.255.255.1280.0.0.127128192.168.1.127192.168.1.126
/26255.255.255.1920.0.0.6364192.168.1.63192.168.1.62
/27255.255.255.2240.0.0.3132192.168.1.31192.168.1.30
/28255.255.255.2400.0.0.1516192.168.1.15192.168.1.14
/29255.255.255.2480.0.0.78192.168.1.7192.168.1.6
/30255.255.255.2520.0.0.34192.168.1.3192.168.1.2
/31255.255.255.2540.0.0.12192.168.1.1point-to-point

Formula Breakdown

ipInt = packed 32 bitsPack the octets as ipInt = o1 × 16777216 + o2 × 65536 + o3 × 256 + o4, giving a single unsigned integer for the address.
mask from prefixThe mask is 0xFFFFFFFF shifted left by 32 minus the prefix, then read as unsigned. A /26 gives 255.255.255.192.
wildcard = NOT maskInvert the mask bit by bit. The /26 mask inverts to the wildcard 0.0.0.63, marking the six host bits.
network = ipInt AND maskBitwise AND clears the host bits, leaving the subnet start. 192.168.1.10 AND the /26 mask gives 192.168.1.0.
broadcast = network OR wildcardOR-ing the wildcard sets every host bit to one. 192.168.1.0 OR 0.0.0.63 gives the broadcast 192.168.1.63.
last host = broadcast - 1The broadcast is reserved, so the highest usable host is one below it, here 192.168.1.62.
magic = 256 - mask octetIn the interesting octet, the block size is 256 minus that octet value. For 192 the interval is 64, so blocks step 0, 64, 128, 192.
limited broadcast255.255.255.255 is the limited broadcast that never leaves the local link, while the value above is the directed broadcast for this specific subnet.

💡Broadcast Address Tips

The magic-number shortcut: To find a broadcast by hand, look at the interesting octet where the mask is not 0 or 255. Compute 256 minus that mask octet to get the block size. For a /27 the mask octet is 224, so the interval is 32, and blocks land on 0, 32, 64, 96 and up. The broadcast is the next block boundary minus one, so the block starting at 64 ends at 95.
Broadcast always ends odd: Because the broadcast fills every host bit with 1, its final octet is always one less than a power-of-two boundary and therefore odd for any prefix from /1 to /30. A /24 ends in 255, a /26 ends in 63, and a /28 ends in 15. If your computed broadcast ends in an even number, the host bits are not all set and the math is wrong somewhere.

This page has a broadcast address calculator. What’s it calculate? It gives you the answer to exactly one question: “Given a host and a subnet mask, what is the only address that reaches all devices on that local network?”

That would be directed broadcast address, the single address right up there at the top of the block. The calculator use the subnet mask, subtracts 1 from it (aka the wildcard mask), and then ORs that into the network address. The result is the directed broadcast address. And it displays the magic-number shortcut version of the calculation so that you can do the same thing in your head.

How to Find the Broadcast Address

IPv4 subnets set aside two special addresses: the network address (all zeroes for the host bits) and the broadcast address (all ones). Packets destined for the broadcast address gets to all devices on that subnet at once. For example, in a simple /24 like 192.168.1.0, the broadcast address is 192.168.1.255. Broadcast is used by older protocols like NetBIOS name resolution and legacy DHCP discovery. If you’re authoring firewall rules, it’s important to know the precise value.

Two methods of calculating a broadcast commonly arise. Routers does it this way and so does this calculator (wildcard method). It calculates the wildcard mask (the bitwise inverse of the subnet mask). Then it calculates the network address by ANDing the host IP with the mask. Finally, it calculates the broadcast by ORing the network address with the wildcard.

The wildcard marks host bits with ones, the mask clears host bits and the network OR wildcard sets them all. Then it packs all four octets into a single 32-bit integer under the hood. It shifts a full field (32 minus the prefix length) left to get the mask from the prefix. The ones-complement of that is the wildcard. It perform an unsigned right shift so none of this ever breaks on the high bits. Then the calculator unpacks it back into dotted decimal.

Optionally, it will show each step in binary where you can watch host bits turn from zero to one. That’s not always available with a calculator at your side. But it also teaches the magic-number trick.

The block size is 256 minus the interesting octet (the part of the mask that is not 0 or 255). In our /27, this is 224; therefore the block size is 32. That means subnet boundaries are 0, 32, 64, and 96. Any given block’s broadcast address is one less than its boundary. One single subtraction is the quickest way to find broadcast addresses by hand.

You can’t assign anything greater than that to your devices, since the broadcast is reserved. If the broadcast of your /28 is 192.168.1.31 then your last valid host will be 192.168.1.30. Never hand out the broadcast accidently, the calculator brings that right to your attention.

There are two edge cases worth noting. A /31 prefix contain just two addresses, including no separate broadcast. A /32 is simply a single host route; there’s not even a broadcast. Instead of printing some misleading value, the tool kindly accommodates both.

Let me break up types of broadcasts into their own category. First there is the directed broadcast which is unique to a given subnet. Then there is the limited broadcast of 255.255.255.255. Every host knows this one means everyone who is currenty on my local link. Routers never forward a limited broadcast. A directed broadcast is a subnet-only broadcast. Typically they are not allowed to cross router boundaries for security reasons.

Each run is summarized by four cards. There is one for the magic number, another for the last usable host, another for the wildcard mask used, and one more for the broadcast address. Below them is a list of all the breakdowns: rows in binary, rows with prefixes, and rows with hosts. That covers off most common scenarios engineers encounter. These include a home /24, an office /26, a VLAN /27, and a DMZ /28. Each preset loads actual octets, fires up the calculation instantly and you get to watch it go: the broadcast shift as the prefix tightens.

Subnetting errors are quiet but expensive. Two subnets overlapped because block size was miscounted. Traffic dropped because the broadcast was assigned to a server. This calculator uses network OR wildcard to compute the broadcast just as a router does, and it also teaches you the 256-minus-mask shortcut for when you don’t have a calculator handy. It also lets you switch to binary to make it easier to understand.

Plug in a preset and you know your answer will be right each time, it’s just math. You should of used this more often.

Broadcast Address Calculator: CIDR, Wildcard and Magic Number