IP Address to Binary Calculator

IP Address to Binary Calculator

Popular AI Skill PRO

Enter Calculation

Formula

Decimal=Octet 1·224+Octet 2·216+Octet 3·28+Octet 4\text{Decimal} = \text{Octet 1} \cdot 2^{24} + \text{Octet 2} \cdot 2^{16} + \text{Octet 3} \cdot 2^{8} + \text{Octet 4}

Example

Decimal=192·224+168·216+1·28+1=3,232,235,777\text{Decimal} = 192 \cdot 2^{24} + 168 \cdot 2^{16} + 1 \cdot 2^{8} + 1 = 3{,}232{,}235{,}777
Show calculation steps (1)
  1. Binary Representation

    Binary=bin8(Octet 1).bin8(Octet 2).bin8(Octet 3).bin8(Octet 4)\text{Binary} = \text{bin}_8\!\left(\text{Octet 1}\right).\,\text{bin}_8\!\left(\text{Octet 2}\right).\,\text{bin}_8\!\left(\text{Octet 3}\right).\,\text{bin}_8\!\left(\text{Octet 4}\right)

    Each octet is converted to an 8-bit binary string, separated by dots.

Usage stats

Advertisement

Results

Binary (dotted)
11000000.10101000.00000001.00000001
8 bits per octet
Continuous binary 11000000101010000000000100000001
Decimal integer 3,232,235,777
Hexadecimal C0.A8.01.01

Report an error on this page

What is the IP Address to Binary Calculator?

An IPv4 address such as 192.168.1.1 is really just a 32-bit number, written for human convenience as four decimal numbers (octets) separated by dots. This calculator converts those four octets into their binary representation, into a single 32-bit decimal integer, and into hexadecimal — the three forms network engineers, programmers and students switch between most often.

How to use it

Enter each of the four octets, every one a whole number from 0 to 255. Click calculate and you instantly get the dotted-binary form (eight bits per octet), the continuous 32-bit binary string, the equivalent decimal integer, and the dotted hexadecimal form.

The formula explained

Each octet is converted to binary and left-padded with zeros to exactly 8 bits, so 1 becomes 00000001 and 255 becomes 11111111. Joining all four gives a 32-bit value. The decimal integer is found by weighting each octet by its position:

$$\text{Decimal} = \text{Octet 1} \cdot 2^{24} + \text{Octet 2} \cdot 2^{16} + \text{Octet 3} \cdot 2^{8} + \text{Octet 4}$$

Because each octet is 8 bits, shifting left by 24, 16 and 8 bits places them in the correct part of the 32-bit word.

Advertisement
IPv4 address split into four 8-bit octets forming a 32-bit binary value
Each of the four octets becomes 8 binary bits, together forming a 32-bit address.

Worked example

Take 192.168.1.1. In binary: \(192 = 11000000\), \(168 = 10101000\), \(1 = 00000001\), \(1 = 00000001\), giving 11000000.10101000.00000001.00000001. The decimal integer is

$$192 \times 16{,}777{,}216 + 168 \times 65{,}536 + 1 \times 256 + 1 = 3{,}221{,}225{,}472 + 11{,}010{,}048 + 256 + 1 = \mathbf{3{,}232{,}235{,}777}$$

In hex: C0.A8.01.01.

Eight-bit place value chart converting binary to a decimal octet
Place values from 128 down to 1 show how 8 bits map to one decimal octet.

Common IPv4 Address Ranges in Binary

These special-purpose IPv4 blocks are defined by IETF standards and apply to IPv4 networks worldwide. The "fixed bits" column shows the prefix bits that every address in the block shares.

Range Address span First octet (decimal / binary) Fixed leading bits Purpose
10.0.0.0/8 10.0.0.0 – 10.255.255.255 10 / 00001010 00001010 (8 bits) Private use (RFC 1918)
172.16.0.0/12 172.16.0.0 – 172.31.255.255 172 / 10101100 10101100.0001 (12 bits) Private use (RFC 1918)
192.168.0.0/16 192.168.0.0 – 192.168.255.255 192 / 11000000 11000000.10101000 (16 bits) Private use (RFC 1918), typical home and office LANs
127.0.0.0/8 127.0.0.0 – 127.255.255.255 127 / 01111111 01111111 (8 bits) Loopback (the local host, e.g. 127.0.0.1)
169.254.0.0/16 169.254.0.0 – 169.254.255.255 169 / 10101001 10101001.11111110 (16 bits) Link-local, self-assigned addresses (RFC 3927)
224.0.0.0/4 224.0.0.0 – 239.255.255.255 224 / 11100000 1110 (4 bits) Multicast
0.0.0.0 single address 0 / 00000000 all 32 bits are 0 "This host" / unspecified address; also used as the default route 0.0.0.0/0
255.255.255.255 single address 255 / 11111111 all 32 bits are 1 Limited broadcast on the local network

Full dotted-binary forms: 10.0.0.0 = 00001010.00000000.00000000.00000000, and 192.168.0.0 = 11000000.10101000.00000000.00000000.

Binary Place Values and Octet Powers of Two

Each IPv4 octet is 8 bits. Bit 7 (the leftmost) is worth 128 and bit 0 (the rightmost) is worth 1.

Bit position 7 6 5 4 3 2 1 0
Power of two 27 26 25 24 23 22 21 20
Place value 128 64 32 16 8 4 2 1

To get the 32-bit integer, each octet is multiplied by a position weight:

Octet Multiplier Value
Octet 1 224 16,777,216
Octet 2 216 65,536
Octet 3 28 256
Octet 4 20 1

Octet values that appear often in subnet masks and addresses:

Decimal Binary Hex
128 10000000 80
192 11000000 C0
224 11100000 E0
240 11110000 F0
248 11111000 F8
252 11111100 FC
254 11111110 FE
255 11111111 FF
Advertisement

How to Convert an IP Address to Binary by Hand

Example address: 10.0.0.5.

  1. Split into four octets. 10.0.0.5 gives 10, 0, 0 and 5. Each must be between 0 and 255.
  2. Find the bits of each octet. Go through the place values 128, 64, 32, 16, 8, 4, 2, 1. Write 1 if the value fits into the remaining number (and subtract it), otherwise write 0. For 10: 128 no, 64 no, 32 no, 16 no, 8 yes (remainder 2), 4 no, 2 yes (remainder 0), 1 no, giving 00001010. For 5: 4 + 1 gives 00000101. (Alternatively, divide repeatedly by 2 and read the remainders from bottom to top.)
  3. Pad each octet to 8 bits. Add leading zeros so every octet has exactly 8 digits: 0 becomes 00000000.
  4. Join with dots. 10.0.0.5 = 00001010.00000000.00000000.00000101.
  5. Convert to hexadecimal. Split each octet into two 4-bit nibbles and convert each to a hex digit. 00001010 = 0000 1010 = 0A, and 00000101 = 0101 = 05, so 10.0.0.5 = 0A.00.00.05, or 0x0A000005. For another octet: 168 = 128 + 32 + 8 = 10101000 = 1010 1000 = A8.
  6. Compute the 32-bit integer. Multiply each octet by its position weight and add:

$$\text{Decimal} = o_1 \cdot 2^{24} + o_2 \cdot 2^{16} + o_3 \cdot 2^{8} + o_4$$

$$10 \cdot 16777216 + 0 \cdot 65536 + 0 \cdot 256 + 5 = 167772160 + 5$$

The 32-bit integer for 10.0.0.5 is 167772165, which matches 0x0A000005 in hex.

FAQ

Why must each octet be 0–255? Each octet is 8 bits, and 8 bits can represent values from 0 to 255 (\(2^{8} = 256\) values).

What is the decimal integer used for? Databases, geolocation tables and routing code often store IPs as a single integer because comparisons and range checks are faster than parsing dotted strings.

Does this work for IPv6? No — IPv6 addresses are 128 bits and written in hex groups. This tool handles IPv4 (32-bit) addresses only.

Last updated:

Most popular in Digital Life

View all Digital Life calculators