Advertisement

IP to Decimal Converter

Convert an IPv4 or IPv6 address to its decimal integer (192.168.1.1 = 3232235777) and back, with the step-by-step sum and bulk conversion of lists.

IPv4 (10.0.0.1), IPv6 (2001:db8::1), or a whole number to convert back to an address.

An IPv4 address is really one 32-bit number; the dotted form 192.168.1.1 just writes its four bytes separately. This converter turns IPv4 and IPv6 addresses into that single decimal integer — the form returned by MySQL's INET_ATON() and used in IP-range tables and some firewall exports — and turns integers back into addresses. Paste a list to convert many at once.

How to use this tool

  1. Type or paste an IP address such as 192.168.1.1 or 2001:db8::1.
  2. To go the other way, enter a whole number such as 3232235777.
  3. Add more lines to convert a list; every line gets its own row in the table.

Formula

decimal = a × 256³ + b × 256² + c × 256 + d

For an IPv4 address a.b.c.d, 256³ = 16,777,216 and 256² = 65,536. IPv6 works the same way with eight 16-bit groups, each multiplied by a power of 65,536, giving a number of up to 39 digits (2¹²⁸ − 1). To convert back, divide by 256 (or 65,536) repeatedly and keep the remainders. Leading-zero IPv4 octets are read as decimal. Paired IPv6 brackets are accepted; zone identifiers must be removed explicitly.

Example

For 192.168.1.1: 192 × 16,777,216 = 3,221,225,472; 168 × 65,536 = 11,010,048; 1 × 256 = 256; plus the last 1. The total is 3232235777. Read as a signed 32-bit integer, the same bits are −1062731519. Entering 3232235777 returns 192.168.1.1.

Frequently asked questions

What is 127.0.0.1 in decimal?

2130706433, from 127 × 16,777,216 + 1. Some URL parsers and network utilities accept a numeric host form, but support varies; dotted decimal is clearer for configuration.

How should I store IP addresses in a database?

For IPv4, an unsigned 32-bit integer column (MySQL INT UNSIGNED) holds every address and makes range lookups fast; INET_ATON() and INET_NTOA() convert both ways. IPv6 needs 128 bits, so use VARBINARY(16) with INET6_ATON(), or the PostgreSQL inet type.

Why does another tool show a negative number?

It is storing the value in a signed 32-bit integer. Addresses from 128.0.0.0 upward have the top bit set and appear negative; add 4,294,967,296 to get the unsigned value.

Are leading zeros allowed?

This tool reads 010 as ten. Some older C functions read a leading zero as octal, so avoid leading zeros in real configuration files.

Sources

Last updated: 2026-10-30

Advertisement