What's the meaning of /24 in the following command?

    route add -net
  • I may be wrong (I haven't used Windows route for a while), but that gateway is from a different subnet. Or is this just a made up example?
    – Azz
    Apr 14, 2011 at 20:43

3 Answers 3


It is the short way of representing a subnet mask.

As Steffen Opel points out in his answer, this is called CIDR notation and the number simply indicates the prefix size used to construct the subnet mask.

So /n means that the first n bits (out of 32 for IPv4) are set to 1, the rest are set to 0. To convert this to a decimal subnet mask you write it in to four octet's and convert to decimal.

So /24 produces because you have twenty four 1 bits and then eigth 0 bits:

Binary:   11111111 11111111 11111111 00000000
Decimal:    255      255      255       0

The short value doesn't have to be a multiple of 8 (ie, it doesn't have to end of the octet boundaries), for example you can take /20 to get as so:

Binary:   11111111 11111111 11110000 00000000
Decimal:    255      255      240       0

Usage with IPv6

The same notation can be appiled to IPv6 as well. Since IPv6 uses 128 bits, instead of 32, the addresses are much larger. I won't go in to the full semantics here, because it's not relevant to the question, but will provide a quick example:

The subnet given in the question is represented by and includes all the IPv4 addresses from to

An IPv6 subnet can be represented in the same way, for example 2001:DB8::/48 contains all IPv6 addresses in the range 2001:DB8:0:0:0:0:0:0 to 2001:DB8:0:FFFF:FFFF:FFFF:FFFF:FFFF.

Note: IPv6 example shamelessly ripped from the Wikipedia CIDR article.

For more info on Subnet masks themselves, what they mean and how the are used, I would recommend you see the question What are the essentials of a Subnet mask?
Or look at the extensive answer to How does Subnetting Work? over at Server Fault.

  • 2
    Each octet is 8bits: 11111111.11111111.11111111.00000000 Oct 6, 2010 at 16:23
  • 3
    So does that mean /16 is and /8 is
    – Corey
    Oct 6, 2010 at 18:53
  • 3
    @Corey yes. And - as per Joe's binary there - just stick in the right number of one's, add enough 0's to reach 32, split in to four bytes and convert to decimal. It doesn't have to be a multiple of 8 either - /20 is for example.
    – DMA57361
    Oct 6, 2010 at 19:01
  • very good, professor DMA57361
    – kokbira
    Apr 14, 2011 at 23:40

DMA57361s answer of this representing a subnet mask is correct and sufficient already (+1) - I'd still like to offer a different approach in explaining this to provide some background regarding the history/motivation for this notation:

"" is the compact specification of an IP address and its associated routing prefix, expressed in CIDR notation:

CIDR notation is constructed from the IP address and the prefix size, the latter being the number of leading 1 bits of the routing prefix. [emphasis mine]

The referenced short Wikipedia article already explains the topic at hand nicely; for a more thorough explanation of many related aspects you might consult the respective parent topic Classless Inter-Domain Routing - in particular you'll find there information about the historical Background for the change from subnet masks to prefix length/size.

Finally, for a good and intuitive representation on how to interpret these notations when you encounter them in practice you might look at the tables within IPv4 subnetting reference as well.

  • 1
    Adds some good depth to the topic. +1
    – DMA57361
    Oct 6, 2010 at 16:11

The /24 is the subnet The /{number} at the end of an IP address is known as CIDR Notation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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