Skip to main content
ponderloop

IP Address Converter

The IPv4 address 192.168.1.1 is the integer 3232235777, 0xC0A80101 in hex and 11000000.10101000.00000001.00000001 in dotted binary. It is a private address (RFC 1918) and its reverse DNS name is 1.1.168.192.in-addr.arpa. Type an address, an integer, a 0x hex value or a binary string and the converter works out every other form; for IPv6, 2001:0db8:0000:0000:0000:0000:0000:0001 compresses to 2001:db8::1 and is the 128-bit integer 42540766411282592856903984951653826561.

Updated Runs in your browser: nothing you enter is uploadedHow this tool works

An IPv4 address (192.168.1.1), an IPv6 address (2001:db8::1), or a number: decimal (3232235777), hex with 0x (0xC0A80101), binary with 0b or as 32 or 128 digits.

Converted

192.168.1.1 = 3232235777

Read as dotted decimal IPv4.

Private (RFC 1918): Private network space, not routed on the public internet.

Dotted decimal
192.168.1.1
Integer (decimal)
3232235777
Hex
0xC0A80101
Dotted hex
0xC0.0xA8.0x01.0x01
Dotted binary
11000000.10101000.00000001.00000001
Binary (32 bits)
11000000101010000000000100000001
Dotted octal (legacy inet_aton)
0300.0250.0001.0001
Reverse DNS name
1.1.168.192.in-addr.arpa
IPv4-mapped IPv6
::ffff:192.168.1.1
IPv4-mapped IPv6 (hex groups)
::ffff:c0a8:101
6to4 prefix
2002:c0a8:101::/48
NAT64 address (64:ff9b::/96)
64:ff9b::c0a8:101
Historical class
Class C

Private and special-use IPv4 address ranges

Each range of the converter’s classification table with its first and last address and size, computed from the table.
RangeNameFirst addressLast addressAddressesStandard
0.0.0.0/8This network0.0.0.00.255.255.25516,777,216RFC 1122
0.0.0.0/32Unspecified address0.0.0.00.0.0.01RFC 1122
10.0.0.0/8Private10.0.0.010.255.255.25516,777,216RFC 1918
100.64.0.0/10Carrier-grade NAT (shared address space)100.64.0.0100.127.255.2554,194,304RFC 6598
127.0.0.0/8Loopback127.0.0.0127.255.255.25516,777,216RFC 1122
169.254.0.0/16Link-local169.254.0.0169.254.255.25565,536RFC 3927
172.16.0.0/12Private172.16.0.0172.31.255.2551,048,576RFC 1918
192.0.0.0/24IETF protocol assignments192.0.0.0192.0.0.255256RFC 6890
192.0.2.0/24Documentation (TEST-NET-1)192.0.2.0192.0.2.255256RFC 5737
192.168.0.0/16Private192.168.0.0192.168.255.25565,536RFC 1918
198.18.0.0/15Benchmarking198.18.0.0198.19.255.255131,072RFC 2544
198.51.100.0/24Documentation (TEST-NET-2)198.51.100.0198.51.100.255256RFC 5737
203.0.113.0/24Documentation (TEST-NET-3)203.0.113.0203.0.113.255256RFC 5737
224.0.0.0/4Multicast224.0.0.0239.255.255.255268,435,456RFC 5771
240.0.0.0/4Reserved for future use240.0.0.0255.255.255.255268,435,456RFC 1112
255.255.255.255/32Limited broadcast255.255.255.255255.255.255.2551RFC 919

IPv4 conversion examples

8 addresses as the converter shows them: 32-bit integer, hex, dotted binary and type.
AddressIntegerHexDotted binaryType
10.0.0.11677721610x0A00000100001010.00000000.00000000.00000001Private
100.64.0.116819159050x6440000101100100.01000000.00000000.00000001Carrier-grade NAT (shared address space)
127.0.0.121307064330x7F00000101111111.00000000.00000000.00000001Loopback
169.254.1.128519959050xA9FE010110101001.11111110.00000001.00000001Link-local
172.16.0.128867297290xAC10000110101100.00010000.00000000.00000001Private
192.168.1.132322357770xC0A8010111000000.10101000.00000001.00000001Private
8.8.8.81347440720x0808080800001000.00001000.00001000.00001000Public
255.255.255.25542949672950xFFFFFFFF11111111.11111111.11111111.11111111Limited broadcast

How 192.168.1.1 becomes 3232235777

Each byte of 192.168.1.1 times the weight of its position; the products add up to the 32-bit integer.
ByteValueWeight of the positionValue × weight
Byte 119216,777,2163,221,225,472
Byte 216865,53611,010,048
Byte 31256256
Byte 4111
Sum——3232235777

Legacy inet_aton spellings of 127.0.0.1

8 ways to write the loopback address that the old inet_aton rules read as 127.0.0.1; the converter accepts them and flags the unusual ones.
You typeRuleRead asFlagged as unusual
127.0.0.1Four parts: each one is a byte127.0.0.1No
127.0.1Three parts: the last one fills the last two bytes127.0.0.1Yes
127.1Two parts: the last one fills the last three bytes127.0.0.1Yes
0x7f.1Hex parts start with 0x127.0.0.1Yes
0x7F000001One part: the whole 32-bit address, here in hex127.0.0.1No
2130706433One part: the whole 32-bit address, here in decimal127.0.0.1No
0177.0.0.1A part with a leading 0 is octal127.0.0.1Yes
017700000001One part in octal127.0.0.1Yes

Special-use IPv6 address ranges

Each range of the converter’s IPv6 classification table with its first and last address and size; the most specific range wins.
RangeNameFirst addressLast addressAddressesStandard
::/128Unspecified address::::1RFC 4291
::1/128Loopback::1::11RFC 4291
::ffff:0:0/96IPv4-mapped address::ffff:0:0::ffff:ffff:ffff2^32 = 4,294,967,296RFC 4291
64:ff9b::/96IPv4/IPv6 translation (NAT64)64:ff9b::64:ff9b::ffff:ffff2^32 = 4,294,967,296RFC 6052
100::/64Discard-only100::100::ffff:ffff:ffff:ffff2^64 = 18,446,744,073,709,551,616RFC 6666
2000::/3Global unicast2000::3fff:ffff:ffff:ffff:ffff:ffff:ffff:ffff2^125 = 42,535,295,865,117,307,932,921,825,928,971,026,432RFC 4291
2001::/32Teredo tunnelling2001::2001:0:ffff:ffff:ffff:ffff:ffff:ffff2^96 = 79,228,162,514,264,337,593,543,950,336RFC 4380
2001:db8::/32Documentation2001:db8::2001:db8:ffff:ffff:ffff:ffff:ffff:ffff2^96 = 79,228,162,514,264,337,593,543,950,336RFC 3849
2002::/166to4 tunnelling2002::2002:ffff:ffff:ffff:ffff:ffff:ffff:ffff2^112 = 5,192,296,858,534,827,628,530,496,329,220,096RFC 3056
3fff::/20Documentation3fff::3fff:fff:ffff:ffff:ffff:ffff:ffff:ffff2^108 = 324,518,553,658,426,726,783,156,020,576,256RFC 9637
fc00::/7Unique local address (ULA)fc00::fdff:ffff:ffff:ffff:ffff:ffff:ffff:ffff2^121 = 2,658,455,991,569,831,745,807,614,120,560,689,152RFC 4193
fe80::/10Link-local unicastfe80::febf:ffff:ffff:ffff:ffff:ffff:ffff:ffff2^118 = 332,306,998,946,228,968,225,951,765,070,086,144RFC 4291
fec0::/10Site-local (deprecated)fec0::feff:ffff:ffff:ffff:ffff:ffff:ffff:ffff2^118 = 332,306,998,946,228,968,225,951,765,070,086,144RFC 3879
ff00::/8Multicastff00::ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff2^120 = 1,329,227,995,784,915,872,903,807,060,280,344,576RFC 4291

IPv6 expand and compress examples

8 IPv6 spellings with the expanded form and the RFC 5952 compressed form the converter produces.
Written asExpandedCompressed (RFC 5952)What happens
2001:0db8:0000:0000:0000:0000:0000:00012001:0db8:0000:0000:0000:0000:0000:00012001:db8::1Leading zeros are dropped and the longest run of zero groups becomes ::
2001:db8:0:0:1:0:0:12001:0db8:0000:0000:0001:0000:0000:00012001:db8::1:0:0:1Two runs of equal length: the first one becomes ::
2001:db8:0:1:0:0:0:12001:0db8:0000:0001:0000:0000:0000:00012001:db8:0:1::1Two runs: the longer one becomes ::
2001:db8:0:1:1:1:1:12001:0db8:0000:0001:0001:0001:0001:00012001:db8:0:1:1:1:1:1A single zero group is written 0, never ::
2001:DB8::ABCD2001:0db8:0000:0000:0000:0000:0000:abcd2001:db8::abcdHex digits are written in lowercase
0:0:0:0:0:0:0:00000:0000:0000:0000:0000:0000:0000:0000::All groups zero: the unspecified address
0:0:0:0:0:0:0:10000:0000:0000:0000:0000:0000:0000:0001::1The loopback address
::ffff:192.0.2.1280000:0000:0000:0000:0000:ffff:c000:0280::ffff:c000:280An IPv4 tail becomes two hex groups

How to convert an IP address

  1. Type or paste the address. Enter an IPv4 address such as 192.168.1.1, an IPv6 address such as 2001:db8::1, or a number: decimal (3232235777), hex starting with 0x (0xC0A80101) or binary (11000000101010000000000100000001).
  2. Check how it was read. The line under the result says how the input was understood: dotted decimal, a decimal, hex or binary number, an IPv6 address, or a legacy spelling. For a plain number you can choose IPv4 or IPv6 yourself.
  3. Take the form you need. An IPv4 address gives the dotted decimal, the 32-bit integer 3232235777, hex 0xC0A80101, dotted hex, dotted binary, reverse DNS name 1.1.168.192.in-addr.arpa and its IPv6 forms. An IPv6 address gives the compressed and expanded forms, the 128-bit integer, hex, binary and reverse name. Press Copy beside any row.
  4. Read the type. The classification line tells you whether the address is private, loopback, link-local, shared, multicast, documentation or public: 192.168.1.1 is private (RFC 1918).
  5. Go the other way. To turn a number into an address, type the number: 3232235777 gives 192.168.1.1. A number that fits in 32 bits is IPv4; for a larger one, or to read a small number as IPv6, choose IPv6 in the list.

Frequently asked questions

How do I convert an IP address to a decimal number?
Multiply each of the four bytes by its position weight and add them up. For 192.168.1.1: 192 × 16,777,216 + 168 × 65,536 + 1 × 256 + 1 × 1 = 3232235777. The weights are 256 to the power 3, 2, 1 and 0. The converter does this for you and shows the 32-bit integer in the second row; the table above lists each product.
How do I convert a decimal number back to an IP address?
Divide the number by 256 four times and keep the remainders, last remainder first. For 3232235777: 12625921 remainder 1, 49320 remainder 1, 192 remainder 168, 0 remainder 192. Read the remainders from the last division to the first: 192.168.1.1. Or just type the number into the converter: a whole number up to 4,294,967,295 is read as IPv4.
How do I convert an IP address to hex or binary?
Write each byte as two hex digits or eight binary digits. 192.168.1.1 is 0xC0.0xA8.0x01.0x01 in dotted hex, which joined is 0xC0A80101, and 11000000.10101000.00000001.00000001 in dotted binary, which joined is the 32-bit binary number 11000000101010000000000100000001. The old inet_aton rules also read dotted octal, 0300.0250.0001.0001. In the other direction type the 0x hex value or the binary digits, with 0b in front or as exactly 32 digits.
How does the converter know whether a number is IPv4 or IPv6?
By its text and its size. A colon means IPv6, four dotted parts mean IPv4. A plain decimal number up to 4,294,967,295 is IPv4 and a bigger one is IPv6. A 0x hex number of up to 8 digits is IPv4 and one of 9 to 32 digits is IPv6, so 0x00000001 is 0.0.0.1 while 0x00000000000000000000000000000001 is ::1; binary works the same with 32 digits as the border. The list under the box overrides this for plain numbers.
How do I expand or compress an IPv6 address?
To expand, write out every group with four hex digits and replace :: with the missing groups of zeros: 2001:db8::1 becomes 2001:0db8:0000:0000:0000:0000:0000:0001. To compress, drop leading zeros in each group, then replace the longest run of two or more all-zero groups with :: (the first run if two are equally long, and never for a single group), in lowercase, as RFC 5952 recommends. 2001:0db8:0000:0000:0000:0000:0000:0001 gives 2001:db8::1 again. The table above shows each case.
What is a reverse DNS name and how is it written?
It is the name under which an address’s PTR record lives. For IPv4 the four bytes are written backwards under in-addr.arpa: 192.168.1.1 is 1.1.168.192.in-addr.arpa. For IPv6 the 32 hex digits of the expanded address are written backwards, one per label, under ip6.arpa: 2001:db8::1 is 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.
What is an IPv4-mapped IPv6 address?
It carries an IPv4 address inside the IPv6 range ::ffff:0:0/96, which dual-stack programs use to treat IPv4 peers as IPv6. 192.168.1.1 maps to ::ffff:192.168.1.1, which in hex groups is ::ffff:c0a8:101. Going the other way, ::ffff:192.0.2.128 is ::ffff:c000:280 and the converter finds its embedded IPv4 address, 192.0.2.128. The well-known NAT64 prefix 64:ff9b::/96 carries one the same way: 64:ff9b::c0a8:101.
What is a 6to4 address?
6to4 builds an IPv6 /48 prefix from the IPv4 address by putting its 32 bits after 2002: 192.168.1.1 gives 2002:c0a8:101::/48. The converter also recognises it in reverse: 2002:c000:204::1 embeds 192.0.2.4. The scheme only makes sense for a public IPv4 address, so a private one like 192.168.1.1 shows the arithmetic but not a usable prefix.
Which IPv4 addresses are private?
RFC 1918 reserves three blocks: 10.0.0.0/8 (16,777,216 addresses), 172.16.0.0/12 (172.16.0.0 to 172.31.255.255, 1,048,576 addresses) and 192.168.0.0/16 (65,536 addresses), 17,891,328 addresses in all. Neighbouring ranges are not private: 172.32.0.0 is public, and 100.64.0.0/10 (100.64.0.0 to 100.127.255.255) is shared address space for carrier-grade NAT under RFC 6598, a separate kind. For comparison 8.8.8.8 is public.
What do 127.1, 0x7f.1 and 0177.0.0.1 mean?
They are legacy spellings from the inet_aton rules that all mean 127.0.0.1: parts can be decimal, octal with a leading 0, or hex with 0x, and when there are fewer than four parts the last one fills all the remaining bytes (127.0.0.1 from 127.1, 10.1.255.255 from 10.1.65535). The converter accepts them and flags them as unusual, because programs disagree: some read 010.0.0.1 as octal (8.0.0.1) and others as decimal or reject it, which has been a source of mistakes in address filters. Write addresses as four plain decimal parts. A part with a digit 8 or 9 after a leading 0, or a part too big for its position, is rejected with a reason.
Why can an IPv6 address not be held in a normal number?
There are 340,282,366,920,938,463,463,374,607,431,768,211,456 IPv6 addresses against 4,294,967,296 for IPv4, far beyond 9,007,199,254,740,991, the largest whole number a JavaScript number or spreadsheet cell holds exactly. The converter uses whole-number BigInt arithmetic throughout, so 2001:db8::1 is exactly 42540766411282592856903984951653826561, with no rounding, and 0x20010DB8000000000000000000000001 in hex.
How do I convert an IP address to an integer in code or SQL?
In Python, int(ipaddress.ip_address('192.168.1.1')) gives 3232235777, and ipaddress.ip_address(3232235777) turns it back into 192.168.1.1. In MySQL, INET_ATON('192.168.1.1') returns 3232235777 and INET_NTOA(3232235777) returns '192.168.1.1'; INET6_ATON does the same for IPv6 as a 16-byte binary string. JavaScript has no built-in: combine the four bytes with multiplication, or end a shift expression with >>> 0, because the shift operators work on signed 32-bit values and give a negative number for any address from 128.0.0.0 up.
Does the converter look up who owns an address or where it is?
No. It rewrites the address in other notations and classifies it from fixed tables of special-use ranges, so it can say that an address is private or documentation but not whether a public address is assigned, to whom, or where. Those answers come from the regional internet registries and geolocation databases.
Can I enter an address with a prefix length such as /24?
Not here: this tool converts one address. A prefix describes a block of addresses, with a netmask, a first and a last address, which the subnet calculator works out. An address with a zone identifier such as %eth0 is also refused, because the zone is not part of the address itself.
What does the type line mean by public?
The converter calls an address public when it lies in none of the special-use ranges of its table; for IPv6 it must also lie in 2000::/3. Other tools draw the line differently: in Python 3.13’s ipaddress module 100.64.0.0 is neither private nor global and is_global is true for multicast, where this converter says multicast. The IPv6 example 2001:db8::1 is documentation, not public, because it is in the range kept for examples.

How it works

Parsing. The text decides the form. A colon means IPv6: any case, :: once, an optional IPv4 tail of four decimal parts, optional square brackets; a zone identifier (%) or a /prefix is refused. A dot means a dotted IPv4 address: four decimal parts from 0 to 255 without leading zeros are plain dotted decimal; four parts of exactly 8 binary digits are dotted binary; anything else is read with the inet_aton rules. Without dots or colons the text is a number: decimal (underscores and thousands commas allowed), hex with 0x, binary with 0b, a string of exactly 32 or 128 binary digits, or, with a leading 0, an octal number (legacy). The inet_aton rules (the inet_aton(3) manual page; the converter was checked against the C library's inet_aton through Python's socket module): up to four parts separated by dots; each part is decimal, octal if it has a leading 0, or hex if it starts with 0x; with four parts each part is a byte, 0 to 255; with three, the first two are bytes and the last is 16 bits and fills the last two bytes; with two, the first is a byte and the last is 24 bits and fills the last three bytes; with one, the number is the whole 32-bit address. Any form other than plain dotted decimal and dotted binary is flagged as unusual. Number size. In automatic mode a decimal number is IPv4 when its value is at most 4,294,967,295 and IPv6 above that, up to 340,282,366,920,938,463,463,374,607,431,768,211,455; a hex string is IPv4 up to 8 digits and IPv6 from 9 to 32; a binary string is IPv4 up to 32 digits and IPv6 from 33 to 128. Choosing IPv4 or IPv6 in the list decides by value instead. Input is limited to 200 characters. Arithmetic. Every address is a BigInt: an IPv4 address is a whole number up to 2^32 − 1 and an IPv6 address one up to 2^128 − 1. Bytes and 16-bit groups are taken with shifts and masks; nothing is a floating-point number. Text forms. IPv6 compression follows RFC 5952: lowercase, no leading zeros in a group, the longest run of two or more zero groups becomes ::, the first run if two tie, and a single zero group stays 0. IPv4-mapped and NAT64 addresses are written in hex groups too, with the dotted form shown separately. Reverse names reverse the four bytes under in-addr.arpa (RFC 1035) and the 32 hex digits under ip6.arpa (RFC 3596). The 6to4 prefix is 2002: followed by the 32 bits of the IPv4 address, /48 (RFC 3056); the NAT64 address uses the well-known prefix 64:ff9b::/96 (RFC 6052); the IPv4-mapped range is ::ffff:0:0/96 (RFC 4291). The historical class is by the first byte: A below 128, B below 192, C below 224, D (multicast) below 240, E above. Classification. Tables in the code list the special-use ranges with their standard: private 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 (RFC 1918), shared address space 100.64.0.0/10 (RFC 6598), loopback 127.0.0.0/8 and this-network 0.0.0.0/8 (RFC 1122), link-local 169.254.0.0/16 (RFC 3927), documentation (RFC 5737, RFC 3849, RFC 9637), multicast (RFC 5771, RFC 4291), unique local fc00::/7 (RFC 4193) and the others listed in the tables above. The most specific range wins. An IPv4 address in none of them is called public, and an IPv6 address is public only inside 2000::/3 and outside every more specific special range. Cross-checks. The unit tests compare the integers, reverse names, compressed and expanded forms and the is_private and is_global flags with Python’s ipaddress module, and the legacy spellings with the C library’s inet_aton. The converter does not contact any server and does not look up ownership or location.

Sources

More: Web, URLs, images and networkAll developer toolsAll toolsHome & DIY calculators