Skip to main content

calculateCIDR

PyPI version License: MIT GitHub stars

CLI CIDR network calculator with IPv4 & IPv6 support, wildcard mask, subnet division and binary display.


✨ Features

  • 🌐 IPv4 & IPv6 — full support for both address families
  • 🧩 Subnet division — split any network into N subnets with correct prefix math
  • 🔢 Wildcard mask — inverse netmask (Cisco-style) included in every output
  • 🔠 Binary display — view any field in binary octet notation (IPv4)
  • 📏 Flexible output — horizontal (default) or vertical format
  • 🌈 Color-coded — ANSI colors for fast readability

📥 Installation

pip install cidr-calculator

Or clone and install locally:

git clone https://github.com/serber1990/calculateCIDR.git
cd calculateCIDR
pip install -e .

🛠 Usage

cidr -ip <IP/PREFIX> [-divide N] [-binary] [-vertical] [-v] [-h]
Flag Description
-ip IP/PREFIX IP address with CIDR prefix — required
-divide N Split the network into N subnets
-binary Display results in binary (IPv4 only)
-vertical Vertical output format (without -divide)
-v Show version
-h Show help

🎨 Examples

Basic calculation

cidr -ip 192.168.1.0/24
+-----------------+-------------+-----------+-----------+-----------------+---------------+---------------+---------+
| Network         | Network ID  | Gateway   | Last Host | Broadcast       | Netmask       | Wildcard      | Hosts   |
+=================+=============+===========+===========+=================+===============+===============+=========+
| 192.168.1.0/24  | 192.168.1.0 | 192.168.1.1 | 192.168.1.254 | 192.168.1.255 | 255.255.255.0 | 0.0.0.255 | 254 |
+-----------------+-------------+-----------+-----------+-----------------+---------------+---------------+---------+

Vertical format

cidr -ip 10.0.0.0/8 -vertical

Subnet division

cidr -ip 192.168.1.0/24 -divide 4

Splits /24 into 4 subnets (/26), showing network ID, gateway, last host, broadcast, netmask, wildcard and host count for each.

Binary display

cidr -ip 192.168.1.0/24 -binary

IPv6

cidr -ip 2001:db8::/32

📝 License

MIT — see LICENSE.


💬 Feedback

Open an issue or reach out via GitHub.

🌐 Connect

GitHub

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cidr_calculator-2.0.0.tar.gz (17.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cidr_calculator-2.0.0-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

Details for the file cidr_calculator-2.0.0.tar.gz.

File metadata

  • Download URL: cidr_calculator-2.0.0.tar.gz
  • Upload date:
  • Size: 17.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for cidr_calculator-2.0.0.tar.gz
Algorithm Hash digest
SHA256 3d4739e09da10b46ccb779e370d9b7fbc385ad67b591466f2690c8da72ec592c
MD5 0138fa6f0f4bd18f992edf78cb7c3653
BLAKE2b-256 b228058385065bd9d6cd596d8f9de5e67fb54bab8d293371d4e882f7073375e6

See more details on using hashes here.

File details

Details for the file cidr_calculator-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cidr_calculator-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3e7c79da82210cbb3ab551ba8df44e8d54bba576c9bc713690af4f47ad4a1255
MD5 02e42fe874f6ea78d4040b94b90ff697
BLAKE2b-256 d79de839309e98eb119b23957b26471c9ca141af047168bdc0daa08e2ef154a3

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page