I'm struggling to understand how to compute the CIDR number from an IP address for hours. Examples I've seen don't explain how the provided answer was found. For example, if I have the IP, I thought the CIDR number was 24 because is a class C address with a subnet mask of so the first 24 bits would be 1s. Is this answer correct? If not, please explain how to find the CIDR number in this case. Thanks.

1 Answer 1


Network classes were deprecated in 1993 by RFCs 1517, 1518, and 1519, which defined CIDR. Modern networking does not use network classes.

The CIDR number is simply the number of one bits in the network mask. You cannot get a CIDR number from an address, it comes from the network mask.

You have no idea what the number is for your example of, but if you had the mask, you would know that it is 26. So, with a mask of would be

  • So, the mask was arbitrarily chosen?
    – sam_smith
    Dec 9, 2017 at 22:38
  • Yes. You can have any mask length from 0 to 32 on any network address. Basically you are saying that X number of address bits comprise the network number, and 32-X number of bits are the host number within that network. See the excellent answer to this question. You must do IP math in binary, otherwise you will make mistakes.
    – Ron Maupin
    Dec 9, 2017 at 22:42
  • One more quick question. Based on my understanding of your answer, if I had the mask, then the CIDR notation would be 24? Thanks.
    – sam_smith
    Dec 9, 2017 at 22:47
  • That is correct. is 11111111.11111111.11111111.00000000 in binary. If you count the number of one bits, it totals 24. The one bits are the network, and the zero bits are the host.
    – Ron Maupin
    Dec 9, 2017 at 23:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.