CIDR calculator: IP address to CIDR range

Calculate IP ranges and subnets from CIDR.

Was this helpful?
Share Tool

This page does IPv4 subnet arithmetic in the current browser tab. Type an address in IP Address (the default is 192.168.1.1) and drag Subnet Mask between /0 and /32 (the default is /24). The cards update as you change either control: Network Address, Usable Hosts, CIDR Range, Subnet Mask, First IP, Last IP, Broadcast, and Total IP Count. There is no submit button. FlashKit does not push the result into a VPC, security group, or firewall. Closing the tab forgets the numbers.

The math matches the controls. The address is parsed as four decimal octets and packed into a 32-bit integer. The mask is (−1) shifted left by (32 − prefix). Network is address AND mask. Broadcast is network OR the inverse mask. Total IP Count is 2^(32−prefix). Usable Hosts is that total minus 2, or 0 when the total is 2 or less — so /31 and /32 show 0 usable hosts. This page does not implement RFC 3021 (two usable addresses on a /31). IPv6 is not calculated: the parser only accepts dotted IPv4. Pasting 2001:db8::/32 leaves the previous IPv4 result on screen. Use the IPv4-to-IPv6 converter if you only needed mapped notation, not prefix math.

Worked example — default 192.168.1.1/24. Network Address 192.168.1.0, subnet mask 255.255.255.0, first IP 192.168.1.1, last IP 192.168.1.254, broadcast 192.168.1.255, total 256, usable 254. The host bits are 32−24 = 8, and 2^8 = 256. Worked example — 10.0.0.0/24. Network 10.0.0.0, mask 255.255.255.0, first 10.0.0.1, last 10.0.0.254, broadcast 10.0.0.255, usable 254. Worked example — 192.168.1.0/28. Host bits 4, total 16, usable 14, mask 255.255.255.240, first 192.168.1.1, last 192.168.1.14, broadcast 192.168.1.15. Worked example — 10.8.0.5/16. Network 10.8.0.0, mask 255.255.0.0, first 10.8.0.1, last 10.8.255.254, broadcast 10.8.255.255, total 65,536, usable 65,534.

Use this when you are planning an ACL, a home lab VLAN, or a Terraform comment and want a second pair of eyes on the range. Confirm with your cloud console before you punch a hole. A /12 like 172.16.0.1/12 is network 172.16.0.0, mask 255.240.0.0, last usable 172.31.255.254 — that is a million addresses, not a “small lab.” A /30 (common on point-to-point links) from 192.168.1.10/30 is network 192.168.1.8, usable 192.168.1.9–10, broadcast 192.168.1.11, two usable hosts. Invalid IPv4 (letters, five octets) is parsed as 0 and the cards stop updating until you fix the address.

The UI matches this copy. IP Address is a text field. Subnet Mask is a range slider labelled /0, /16, /24, /32 under the track. Network Details is the blue card. The white card lists mask, first, last, broadcast, and total. There is no IPv6 box, no wildcard-mask toggle, and no export to Terraform. Related tools: IPv4-to-IPv6 (mapped notation only), IP geo lookup, domain-to-IP, WHOIS. Related guides: network troubleshooting for web developers, and SSL/TLS certificates — useful after the subnet is planned and you still need to serve HTTPS. You can also work out a CIDR range by hand and check the cards against that arithmetic.

How to calculate an IPv4 subnet

  1. Type a dotted IPv4 address. The default 192.168.1.1/24 is a complete worked example.
  2. Drag the Subnet Mask slider to the prefix you need (/24 for a typical LAN, /28 for a small block, /32 for a single host).
  3. Read Network Address, mask, first/last usable, broadcast, total count, and usable hosts.
  4. Copy the range into a ticket or Terraform comment. This page does not change any live network.
  5. For IPv6 prefixes, use a dedicated IPv6 subnet tool — this calculator’s parser is IPv4 only despite the URL name.

Key Features

  • IPv4 network, mask, broadcast, first/last, total and usable hosts
  • Live slider from /0 to /32 — no submit button
  • Usable hosts = total − 2, or 0 for /31 and /32
  • Local arithmetic — no VPC API and no account
  • Pairs with IP lookup, domain-to-IP, WHOIS, and IPv4-mapped IPv6 notation

How the IPv4 math works

  • Pack the four octets: 192.168.1.1 = 192×16777216 + 168×65536 + 1×256 + 1.
  • Mask = (−1) << (32 − prefix). For /24 that is 255.255.255.0. For /28, 255.255.255.240. For /16, 255.255.0.0.
  • Network = address AND mask. Broadcast = network OR NOT mask. First = network + 1. Last = broadcast − 1.
  • Total = 2^(32−prefix). Usable = total − 2 when that is positive, else 0. RFC 3021 /31 point-to-point usable=2 is not implemented.
  • IPv6 is not parsed. A colon in the box fails the IPv4 regex and the previous result stays on screen.

Worked CIDR examples

  • 192.168.1.1/24 → network 192.168.1.0, mask 255.255.255.0, usable 192.168.1.1–254, broadcast 192.168.1.255, 254 usable.
  • 10.0.0.0/24 → network 10.0.0.0, usable 10.0.0.1–254, broadcast 10.0.0.255, 254 usable. Typical RFC 1918 LAN.
  • 192.168.1.0/28 → 16 addresses, 14 usable, mask 255.255.255.240, last 192.168.1.14, broadcast 192.168.1.15.
  • 10.8.0.5/16 → network 10.8.0.0, mask 255.255.0.0, last 10.8.255.254, 65,534 usable — a whole class-B-sized block.
  • 192.168.1.10/30 → network 192.168.1.8, usable 192.168.1.9 and .10, broadcast .11. /32 of 192.168.1.1 → one address, 0 usable on this page.

Limits, privacy, and tips

  • This is not a live route table, AWS security-group editor, or nftables writer. Confirm before you open a hole.
  • The URL says ipv4-ipv6 but the form is IPv4 only. Mapped notation (::ffff:c0a8:0101) lives on the IPv4-to-IPv6 page.
  • Octets above 255 still parse as integers and can produce surprising networks. Prefer canonical 0–255 dotted quads.
  • Privacy: the address never leaves this tab. Still avoid putting production CIDRs on a projector if that is sensitive.
  • Related guide: network troubleshooting (IP, DNS, WHOIS, CIDR). After the subnet exists, the SSL/TLS guide covers certificates.

Frequently Asked Questions

Does this change my firewall or VPC?

No. It only prints numbers in this tab. Copy them into the console, Terraform, or a ticket yourself.

Can it calculate IPv6 prefixes?

No. The parser only accepts dotted IPv4. The slug mentions IPv6 for historical naming. Use a dedicated IPv6 subnet calculator for 2001:db8::/32.

Why do /31 and /32 show 0 usable hosts?

The tool always subtracts 2 from the total, and floors at 0. It does not implement RFC 3021 (two usable addresses on a /31). A /32 is a single address.

What is the default example?

192.168.1.1/24 → network 192.168.1.0, mask 255.255.255.0, first 192.168.1.1, last 192.168.1.254, broadcast 192.168.1.255, 254 usable hosts.

Is the address uploaded?

No. Arithmetic runs in this tab. Refreshing restores 192.168.1.1 /24. Nothing is written to FlashKit.

How do I get an IPv6 form of an IPv4 address?

Open the IPv4-to-IPv6 converter for mapped notation (::ffff:…). That is not a public IPv6 allocation and not prefix math.

Expert Guide for CIDR Calculator

View Blog
CIDR to IP Range: Calculate First and Last IP by Hand

CIDR to IP Range: Calculate First and Last IP by Hand

Convert CIDR to an IP range by hand: find the mask, network and broadcast addresses and the usable hosts. Worked /24, /27 and /30 examples.

Read Guide

Categories

Browse all FlashKit tools