>_ DevTrendsen

Language

Home

Languages

Sections

Frontend Backend Mobile DevOps AI / ML GameDev Blockchain Embedded Security
TypeScript

How to Stop Calculating Subnet Masks in Your Head and Start Living

Every team has that person who answers "how many addresses in /26?" at calculator speed and instantly tells you whether 10.0.13.37 falls within the 10.0.12.0/22 range. I'm not that person. Every time I need to work with a network, I open Python and start clicking bits. That was until I stumbled upon cidr.xyz.

What Is This Thing Anyway

cidr.xyz is a CIDR calculator and subnet visualizer created by a developer going by yuvadm. The project has been around for a while: the repository was created in December 2015, and since then it's accumulated about 850 stars and 238 forks. The service itself lives at cidr.xyz and runs entirely in the browser.

The idea is refreshingly simple: you enter an IP address and mask (either in CIDR notation or the classic 255.255.255.0 format), and the page instantly shows everything you can extract from that pair. The first line after input is a ready-to-use CIDR suffix that you can copy straight into your config.

What the Calculator Shows

Let me walk through an example. We enter 10.0.13.37 with mask /22. The output gives us:

  • Network and broadcast address
  • First and last usable host address
  • Number of hosts in the subnet
  • Address and mask in binary, bit by bit
  • Wildcard mask (that 0.0.3.255 you can't write ACLs without)
  • "Range of everything" format — the familiar string for pfSense or Cisco configs
  • Binary mask in decimal form

Sounds like any ipcalc description, but there's one thing that sets cidr.xyz apart from a hundred similar tools — visualization. Below the input fields, a bit grid is drawn: 32 bits of address and 32 bits of mask, split into octets. The bits responsible for network and host are highlighted in different colors.

And that's when the moment of realization hits. Before, I knew that /22 means 22 network bits, but I kept that in my head as abstract knowledge. On cidr.xyz, you can see the boundary between network and host parts jump around as you drag the mask from /24 to /21. You immediately understand why 10.0.13.37/22 means the 10.0.12.0 network — the third octet 13 in binary is 00001101, and with a /22 mask, the first six bits of the third octet are frozen by the network, the remaining six bits are given to hosts. No table gives you that "oh, that's what it is" feeling.

Who This Is For

First and foremost, those preparing for interviews or certifications. Questions about VLSM and network subdivision appear in CCNA, and understanding bit arithmetic really is necessary there.

Second, admins and SREs working with configs. Quickly verifying that the wildcard mask for an ACL is calculated correctly, that the 172.16.0.0/12 range actually ends at 172.31.255.255 — that's a ten-second task.

Third, everyone else who encounters networking once a month and once a month forgets how it works. I'm in this category.

Under the Hood

The project is written in TypeScript, using React and Next.js. The README is minimal to the extreme — just two sections — but that's enough to run a local copy:

npm install
npm run dev

After that, the tool is available at localhost:3000, and you can dig into the code or customize it for yourself. For example, I was seriously thinking about adding subnet count calculation when dividing by a given number. This is that rare case where the codebase is so compact that you can realistically raise a pull request in an evening.

Deployment is automated: the master branch flies out through Cloudflare Workers. MIT license, so if you want, you can fork it or embed it somewhere.

A Bit of Criticism

No barrel of honey without a spoonful of tar. The functionality is tailored for IPv4 — the calculator doesn't accept IPv6 addresses. If you live in the world of fd00::/8, this tool won't help you. The binary visualization also sometimes gets overwhelming: at a glance at the blinking bit table, it's easy to land in the wrong place. And yes, 850 stars isn't a million — the project is known in narrow circles, but not forgotten: the last commit to the master branch was recent, the repository is alive.

Is It Worth Trying

Absolutely yes, if you: are preparing for a network interview; making configs for network equipment; want to finally visually understand how a subnet mask cuts up address space. Just add cidr.xyz to your bookmarks next to the translator — it'll come in handy.

And if you want something more, fork the repository and add IPv6 support. Judging by the compactness of the code, it's a perfectly doable weekend task.

Related projects