Tools
CIDR / Subnet Calculator
WORKINGType an address like 192.168.1.0/24, get network, broadcast, mask and usable-host range instantly — no server round trip.
Every field recomputes on keystroke — there’s no submit button because there’s nothing to submit to. The whole thing is computeCidr() in cidr.js: parse the octets and prefix, derive the mask, and the rest — network, broadcast, wildcard, usable range — falls out of AND/OR/NOT against that mask.
The one sharp edge is /0: a 32-bit left-shift by 32 is a no-op in JavaScript, not zero, because shift amounts are masked to 5 bits. Left as the general formula it would silently return the wrong mask for the whole-internet case, so /0 gets its own branch instead.
- Built
- Category
- utility
- Stack
- JavaScript
- Details
- 32-bit unsigned bitwise math on the parsed octets, with an explicit branch for /0 (JS shift amounts are masked to 5 bits, so `<<32` is a no-op) and for /31–/32 (RFC 3021: no reserved network/broadcast, every address is usable).
- Model
- Claude Sonnet 5
- Source
- View source →