Subnet calculator

Use it from Python

Every result on this site comes from ictdesigntools, an open-source (MIT) Python library. Install it in a script, notebook or computational design tool:

pip install ictdesigntools

Then pass the same text you would type into the form:

from ictdesigntools.network.subnet import calculate

r = calculate("192.168.10.37/26")
r.network  # '192.168.10.0/26'
r.netmask  # '255.255.255.192'
r.first_host  # '192.168.10.1'
r.last_host  # '192.168.10.62'
r.usable_hosts  # 62
r.reverse_zone  # '10.168.192.in-addr.arpa'

calculate also accepts an ipaddress.IPv4Interface or IPv6Interface. Input it can't read raises SubnetError, a ValueError whose message says what to fix.

Result fields

Field Example Notes
version 4 4 or 6
address '192.168.10.37' The address entered
network, prefixlen '192.168.10.0/26', 26
netmask, hostmask '255.255.255.192', '0.0.0.63' hostmask is the wildcard mask
broadcast '192.168.10.63' None for IPv6
first_host, last_host '192.168.10.1', '192.168.10.62'
total_addresses, usable_hosts 64, 62 Integers
address_type 'Private'
reverse_zone '10.168.192.in-addr.arpa'
address_binary, netmask_binary '11000000.10101000…' IPv4 only
compressed, exploded '2001:db8::1' IPv6 only

Web API

A web API with the same inputs and results is planned as an invite-only beta. Until then, a result's link, such as /ip/subnet/192.168.10.37/26, is the way to share one.