IP v4 Calculator

IP address
Net mask
CIDR to network mask

CIDR is the number of continuous bits of 1s in IP binary notation.

Examples:

  • Mask /24:

    11111111 11111111 11111111 00000000
       255      255      255        0
  • Mask /12:

    11111111 11110000 00000000 00000000
       255      240        0        0
Network address

Network address is obtained by doing bitwise operation AND on IP and Network Mask. AND operation sets bit when both bits in IP and MASK are set.

Examples:

  • 192.168.1.100/24 => 192.168.1.0/24:

       192      168        1      100
    11000000 10101000 00000001 01100100
    11111111 11111111 11111111 00000000
       255      255      255        0
    ======== ====== AND ====== ========
    11000000 10101000 00000001 00000000
       192      168        1        0
  • 10.28.224.67/12 => 10.16.0.0/12:

        10       28      224       67
    00001010 00011100 11100000 01000011
    11111111 11110000 00000000 00000000
       255      240        0        0
    ======== ====== AND ====== ========
    00001010 00010000 00000000 00000000
        10      16         0        0
Broadcast

Broadcast address is obtained by doing bitwise operation OR between IP address and on mask length part of IP address, then sets bit 1s on the rest part.

Using only bitwise operators it can be obtained by using operator OR between IP address and negated (NOT) mask. IP OR (NOT MASK).

In 31-bit prefixed mask, that is used by Point-to-Point Links is no directed broadcast. Any packet which is transmitted by one client is always received by the other. Limited broadcast (255.255.255.255) is obsolete, but may still be used in a network.

Examples:

  • 192.168.1.100/24 => 192.168.1.255:

       192      168       1       100
    11000000 10101000 00000001 01100100
    11111111 11111111 11111111 00000000
       255      255      255       0
    ======== == AND = ========
    11000000 10101000 00000001 11111111
       192      168       1      255
  • 10.28.224.67/12 => 10.31.255.255:

        10       28      224       67
    00001010 00011100 11100000 01000011
    11111111 11110000 00000000 00000000
       255      240        0        0
    ======== ====== AND ====== ========
    00001010 00011111 11111111 11111111
        10       31      255      255
Hosts range (min/max)

First usable IP address is the next one of network address.

Last usable IP address is the one before broadcast.

Examples:

  • Network address 192.168.1.0/24

    Broadcast 192.168.1.255/24

    Network usable IP range:

    192.168.1.1 - 192.168.1.255

  • Network address 10.16.0.0/12

    Broadcast 10.31.255.255

    Network usable IP range:

    10.16.0.1 - 10.31.255.254

Maximum number of hosts

Number of hosts equation:

Hosts = 2(32-CIDR)-2

Examples:

  • Network address 192.168.1.0/24

    2(32-24)-2 = 254 hosts

  • Network address 10.16.0.0/12

    2(32-12)-2 = 1,048,574 hosts

Wildcard

Wildcard is obtained by using bitwise NOT operator on Network Mask. NOT operator sets bit 1 when it was 0 before and vice versa - sets 0 when it was 1.

Examples:

  • Mask /24:

    11111111 11111111 11111111 00000000
       255      255      255        0
    ======== ====== NOT ====== ========
    00000000 00000000 00000000 11111111
         0        0        0      255
  • Mask /12:

    11111111 11110000 00000000 00000000
       255      240        0        0
    ======== ====== NOT ====== ========
    00000000 00001111 11111111 00000000
         0       15      255      255
Windows DNS priority net mask (LocalNetPriorityNetMask)

In Microsoft Windows Server the netmask ordering feature is used to prioritize local resources, when returning an A DNS record to the client. An A record maps a domain name to the IPv4 address.

LocalNetPriorityNetMask is the same as Wildcard but in HEX notation

Examples:

  • Mask /24 (255.255.255.0)

    Wildcard: 0.0.0.255

    LocalNetPriorityNetMask: 0x000000FF

    Dnscmd /config /LocalNetPriorityNetMask 0x000000FF

  • Mask /12:

    Wildcard: 0.15.255.255

    LocalNetPriorityNetMask: 0x000FFFFF

    Dnscmd /config /LocalNetPriorityNetMask 0x000000FF