# IPv4 to Integer Converter

> Convert a dotted IPv4 address to its 32-bit integer, hexadecimal and binary forms, or turn an integer back into a dotted-quad IP address.

Category: IT, networking & security · Applies to: Worldwide · Last updated: 2026-10-29
Interactive calculator: https://calculators.geekmidst.com/calculators/ipv4-to-integer-converter

An IPv4 address is a 32-bit number written as four bytes. Its integer value is a × 256³ + b × 256² + c × 256 + d, which is how databases and range lookups often store it.

Also called: IP to decimal converter, IP address to long converter.

## Inputs
- Convert (options: IP → integer, Integer → IP; default to_int)
- IPv4 address (default 192.168.1.1)
- Integer (default 3232235777)

## Results
- Result
- Unsigned 32-bit integer
- Dotted-quad address
- Hexadecimal
- Binary (by octet)

## Formula

```
Integer = a × 16,777,216 + b × 65,536 + c × 256 + d;  a = ⌊n ÷ 2²⁴⌋ mod 256, b = ⌊n ÷ 2¹⁶⌋ mod 256, c = ⌊n ÷ 2⁸⌋ mod 256, d = n mod 256
```

Where:
- a.b.c.d: the four octets, each 0–255
- n: the integer, 0 to 4,294,967,295

## Worked example
1. 192 × 16,777,216 = 3,221,225,472; 168 × 65,536 = 11,010,048.
2. 1 × 256 = 256 and the last octet is 1.
3. Sum = 3,232,235,777 = 0xC0A80101.

**Result:** 192.168.1.1 is the integer 3,232,235,777, or 0xC0A80101 in hex.

## What the result means

Storing addresses as unsigned integers makes range checks simple: an address is in a block if its integer lies between the block’s first and last address.

## Assumptions and limits
- Octets are written in decimal; leading zeros are rejected because some software reads them as octal.
- Signed 32-bit integer columns cannot hold addresses from 128.0.0.0 upwards; use an unsigned or 64-bit type.

## Questions

### Why do some tools show a negative number?

They store the value as a signed 32-bit integer. Add 4,294,967,296 to a negative value to get the unsigned form shown here.

### Does this work for IPv6?

No. IPv6 addresses are 128-bit; use the IPv6 Address Compression Calculator for their text forms.

## Related calculators
- [IP Subnet Calculator](https://calculators.geekmidst.com/calculators/ip-subnet-calculator)
- [IPv6 Address Compression Calculator](https://calculators.geekmidst.com/calculators/ipv6-address-compression-calculator)
- [Binary Calculator](https://calculators.geekmidst.com/calculators/binary-calculator)
- [Hex Calculator](https://calculators.geekmidst.com/calculators/hex-calculator)

Source: GM¹X CalcVerse — https://calculators.geekmidst.com/calculators/ipv4-to-integer-converter
