Project: Build a Subnet Calculator

Stop reaching for an online subnet calculator — build your own. Write a Python tool that, given any CIDR, returns the network, broadcast, host range and usable count. Real code, graded on real output.

beginner ⏱ 30 min

The brief

Every engineer subnets. The best ones automate it. Build a subnet calculator in real Python using the ipaddress module — the same logic behind every online tool, now yours.

For the block 192.168.1.0/26, fill in each value. Figure out the right ipaddress calls yourself; the hints point the way.

Subnet Calculator — Python 3
YOUR CODE (edit here, then press Run)
Ctrl/⌘ + Enter
OUTPUT

Take it further

You just rebuilt a tool people pay for. Change the CIDR to /30, /22, or an IPv6 prefix and watch the numbers fall out of the same five lines — that’s the power of modelling the problem instead of memorising tables.

Teaching a class? Embed this free lab on your own page.

Report a problem

About: /labs/subnet-calculator-project

🤖

Need clarification? Ask GT

Hi, I'm GT — your AI tutor for Project: Build a Subnet Calculator. What would you like to know?