Toolyard

How to Calculate a Subnet

CIDR and masks

An IPv4 address is 32 bits. The prefix after the slash says how many of them identify the network; the rest identify hosts. /24 is the mask 255.255.255.0: 24 network bits and 8 host bits, 256 addresses.

/24255.255.255.0256 addresses, 254 hosts
/25255.255.255.128128 addresses, 126 hosts
/26255.255.255.19264 addresses, 62 hosts
/27255.255.255.22432 addresses, 30 hosts
/28255.255.255.24016 addresses, 14 hosts
/30255.255.255.2524 addresses, 2 hosts

Worked example: 192.168.1.130/26

  1. /26 leaves 6 host bits, so each subnet has 26 = 64 addresses.
  2. Subnets start at multiples of 64 in the last number: 0, 64, 128, 192. 130 falls in the one starting at 128.
  3. Network address: 192.168.1.128. Broadcast address, the last in the block: 192.168.1.191.
  4. Usable hosts: 192.168.1.129 to 192.168.1.190, 62 addresses.

The first and last addresses are reserved, so a subnet has 2host bits − 2 usable hosts. /31 links between two routers and single /32 addresses are special cases.

Calculator

The Subnet Calculator works this out for any address and prefix or mask, with the wildcard mask and binary form. To convert the numbers between decimal, binary and hex, use the Number Base Converter.

Tools in this guide

More guides

How to Open HEIC Files on WindowsHow to Reduce PDF File SizeHow to Remove Location Data from PhotosHow to Extract Audio from a VideoHow to Make a Wi-Fi QR CodeHow to Sign a PDFHow to Verify a File Checksum (SHA-256)PNG vs JPG vs WebP: Which Image Format to UseHow to Merge PDF FilesHow to Copy Text from an ImageHow to Convert JPG to PDFHow to Convert a PDF to JPGHow to Split a PDF or Extract PagesHow to Rotate a PDF PermanentlyHow to Add Page Numbers to a PDFHow to Watermark a PDFHow to Convert HEIC to JPG on a MacHow to Convert WebP to JPGHow to Reduce Image File SizeHow to Convert a Video to GIFHow to Convert WAV to MP3How to Create a Strong PasswordHow to Convert Celsius to FahrenheitGB vs GiB: Why Your Drive Shows Less SpaceHow to Calculate PercentagesHow to Calculate the Number of Days Between Two DatesWhat Is a Unix Timestamp?How to Compare Two Text FilesHow to Count Words in a DocumentHow to Scan a QR Code from a Screenshot or ImageWhat Is a Hash? MD5, SHA-1 and SHA-256 ExplainedHow to Compress a Photo to 20 KB (or Any Size)How to Remove the Background From a PhotoHow to Test Your MicrophoneHow to Check a Screen for Dead PixelsHow to Record Your ScreenHow to Make a Ringtone for iPhoneHow to Compress a Video to Send ItHow to Remove a Password From a PDFHow to Password Protect a PDFHow to Fill In a PDF FormHow to Convert a PDF to WordHow to Blur a Face in a PhotoHow to Calculate Your BMIHow to Calculate a Mortgage PaymentHow to Schedule a Meeting Across Time ZonesWhat Is a Cron Expression?How to Reverse Complement a DNA SequenceHow to Translate DNA to ProteinHow to Convert GenBank to FASTAHow to Find Restriction Sites in a DNA SequenceHow to Align Two DNA or Protein SequencesHow to Design and Check PCR PrimersHow to Calculate Molar MassHow to Balance a Chemical EquationHow to Make a Solution of a Given MolarityHow to Calculate a Dilution (C1V1 = C2V2)How to Calculate pHHow to Calculate DNA Concentration From A260How to Calculate Insert Amount for a LigationHow to Convert RPM to g (RCF)How to Count Cells With a HemocytometerHow to Use a Punnett SquareHow to Make a Budget With the 50/30/20 RuleDebt Snowball vs Debt AvalancheHow Much Do I Need to Retire?How to Convert Salary to Hourly PayProfit Margin vs MarkupHow to Calculate VAT and Sales TaxHow to Make an InvoiceHow Much House Can I Afford?How to Read Resistor Color CodesHow to Choose a Resistor for an LEDHow to Calculate Voltage Drop in a CableHow Much Concrete Do I Need?How Much Paint Do I Need?Significant Figures Rules