IP to Decimal Converter

Convert dotted IPv4 addresses into a single unsigned decimal integer.

Result

About this tool

IP to Decimal converts IPv4 dotted-decimal addresses into single unsigned 32-bit integers. Many databases, analytics platforms, and network monitoring tools store IP addresses as integers rather than strings - it is faster to index and compare numbers than text. This tool performs that conversion so you can prepare values for storage queries, scripted comparisons, or log normalization workflows.

Real example

Input: 192.168.1.1

The formula shifts each octet into its 32-bit position:
192 × 16,777,216 (2²⁴) = 3,221,225,472
168 × 65,536 (2¹⁶) = 11,010,048
1 × 256 (2⁸) = 256
1 × 1 = 1
Sum: 3,232,235,777

To reverse: enter 3232235777 in the Decimal to IP tool and confirm you get 192.168.1.1 back.

Common use cases

  • Database range queries: Instead of LIKE '192.168.%', store IPs as integers and query with WHERE ip BETWEEN 3232235520 AND 3232235775 - much faster on large tables.
  • SIEM and log normalization: Some SIEMs ingest integer IPs. Convert the addresses from your application logs to integers before feeding them into the pipeline.
  • Script comparisons: In bash or Python, comparing integers is simpler than string-based IP comparisons. Convert both addresses, then subtract or compare numerically.
  • Analytics export preparation: Web analytics platforms like BigQuery and Redshift often support integer-based IP grouping. This converter prepares values in the correct format.

How it works

The IPv4 address is split into four octets. Each octet is left-shifted into its 32-bit position using the formula: (o1 << 24) + (o2 << 16) + (o3 << 8) + o4. The result is treated as an unsigned 32-bit integer, giving a range from 0 (0.0.0.0) to 4,294,967,295 (255.255.255.255).

Common mistakes

  • Signed vs unsigned integers: In some languages (notably Java and older C code), 32-bit integers are signed. An IP like 192.x.x.x has bit 31 set and becomes negative in signed arithmetic. Always use unsigned 32-bit or 64-bit integers when storing converted IPs.
  • Byte order confusion: This tool uses network byte order (big-endian), which is the standard for IPv4. If your system stores IPs in little-endian format, the bytes will appear reversed and the integers will not match.
  • Not the same as the decimal parts: 192.168.1.1 as a decimal integer is 3,232,235,777 - not a simple concatenation of the octets. 1921681001 is a different number and will not round-trip correctly.

FAQ

Why is the result unsigned
IPv4 address space spans 0 to 2³²−1 (4,294,967,295). Signed 32-bit integers max out at 2,147,483,647, which is not enough. The conversion uses unsigned arithmetic to cover the full range.

What is the decimal for 255.255.255.255
4,294,967,295 - the maximum possible value for an unsigned 32-bit integer.

How do I convert back
Use the Decimal to IP tool - paste the integer and it reconstructs the dotted-decimal address.

Does this work for private IP ranges
Yes. 10.0.0.1 = 167,772,161 and 172.16.0.1 = 2,886,729,729. The math is the same regardless of whether the address is public or private.

Learn more

For a complete breakdown of IPv4 address formats - dotted-decimal, binary, hexadecimal, and integer - and how they relate to each other, see the IP Addressing & Networking Guide. For subnet planning and CIDR notation, the CIDR Subnetting Explained article walks through host range calculations with worked examples.

Why convert IP to decimal

The dotted-decimal format humans read — 192.168.1.1 — is a display convention. The actual IP address is a 32-bit unsigned integer. Every network device, every routing table, every kernel socket operation works with the integer form internally. The four decimal octets are just the human interface layered on top.

The most common reason to convert explicitly is database storage. Storing IPs as INT UNSIGNED in MySQL (or as bigint in PostgreSQL, which uses signed 64-bit integers) rather than VARCHAR(15) has two concrete advantages: the column is 4 bytes instead of up to 15, and range queries are dramatically faster. Finding all IPs in a /24 subnet with integer storage is WHERE ip BETWEEN 3232235776 AND 3232236031 — an indexed range scan. With VARCHAR storage, the equivalent query requires string parsing or a full table scan.

A second use case is integer-based subnet membership checks. Given a decimal IP and a decimal network address with a mask, the membership test is: (ip & mask) == network. All integer arithmetic, no string splitting required. This is how high-performance firewalls, load balancers, and routing engines evaluate rules at line rate.

The conversion: how four octets become one integer

Each octet represents 8 bits. To combine four octets into a single 32-bit integer: multiply the first octet by 2²⁴ (16,777,216), the second by 2¹⁶ (65,536), the third by 2⁸ (256), and add the fourth. For 192.168.1.1: (192 × 16,777,216) + (168 × 65,536) + (1 × 256) + 1 = 3,221,225,472 + 11,010,048 + 256 + 1 = 3,232,235,521.

In bitwise notation this is identical to: (o1 << 24) | (o2 << 16) | (o3 << 8) | o4. The shift-and-OR form is what JavaScript, Python, and C all use internally to implement this conversion in a single expression.

See also: Decimal to IP (reverse), IP to Hex, IP to Binary, CIDR IP Converter.

Related tools

  • Decimal to IP — reverse — convert a decimal integer back to dotted notation
  • IP to Binary — see the 32-bit binary breakdown of the same address
  • IP to Hex — convert the same address to 8-character hexadecimal
  • CIDR / IP Converter — use the decimal value in integer-based subnet range queries