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
Converted
192.168.1.1 = 3232235777
Read as dotted decimal IPv4.
Private (RFC 1918): Private network space, not routed on the public internet.
Unusual spelling
- 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
| Range | Name | First address | Last address | Addresses | Standard |
|---|---|---|---|---|---|
| 0.0.0.0/8 | This network | 0.0.0.0 | 0.255.255.255 | 16,777,216 | RFC 1122 |
| 0.0.0.0/32 | Unspecified address | 0.0.0.0 | 0.0.0.0 | 1 | RFC 1122 |
| 10.0.0.0/8 | Private | 10.0.0.0 | 10.255.255.255 | 16,777,216 | RFC 1918 |
| 100.64.0.0/10 | Carrier-grade NAT (shared address space) | 100.64.0.0 | 100.127.255.255 | 4,194,304 | RFC 6598 |
| 127.0.0.0/8 | Loopback | 127.0.0.0 | 127.255.255.255 | 16,777,216 | RFC 1122 |
| 169.254.0.0/16 | Link-local | 169.254.0.0 | 169.254.255.255 | 65,536 | RFC 3927 |
| 172.16.0.0/12 | Private | 172.16.0.0 | 172.31.255.255 | 1,048,576 | RFC 1918 |
| 192.0.0.0/24 | IETF protocol assignments | 192.0.0.0 | 192.0.0.255 | 256 | RFC 6890 |
| 192.0.2.0/24 | Documentation (TEST-NET-1) | 192.0.2.0 | 192.0.2.255 | 256 | RFC 5737 |
| 192.168.0.0/16 | Private | 192.168.0.0 | 192.168.255.255 | 65,536 | RFC 1918 |
| 198.18.0.0/15 | Benchmarking | 198.18.0.0 | 198.19.255.255 | 131,072 | RFC 2544 |
| 198.51.100.0/24 | Documentation (TEST-NET-2) | 198.51.100.0 | 198.51.100.255 | 256 | RFC 5737 |
| 203.0.113.0/24 | Documentation (TEST-NET-3) | 203.0.113.0 | 203.0.113.255 | 256 | RFC 5737 |
| 224.0.0.0/4 | Multicast | 224.0.0.0 | 239.255.255.255 | 268,435,456 | RFC 5771 |
| 240.0.0.0/4 | Reserved for future use | 240.0.0.0 | 255.255.255.255 | 268,435,456 | RFC 1112 |
| 255.255.255.255/32 | Limited broadcast | 255.255.255.255 | 255.255.255.255 | 1 | RFC 919 |
IPv4 conversion examples
| Address | Integer | Hex | Dotted binary | Type |
|---|---|---|---|---|
| 10.0.0.1 | 167772161 | 0x0A000001 | 00001010.00000000.00000000.00000001 | Private |
| 100.64.0.1 | 1681915905 | 0x64400001 | 01100100.01000000.00000000.00000001 | Carrier-grade NAT (shared address space) |
| 127.0.0.1 | 2130706433 | 0x7F000001 | 01111111.00000000.00000000.00000001 | Loopback |
| 169.254.1.1 | 2851995905 | 0xA9FE0101 | 10101001.11111110.00000001.00000001 | Link-local |
| 172.16.0.1 | 2886729729 | 0xAC100001 | 10101100.00010000.00000000.00000001 | Private |
| 192.168.1.1 | 3232235777 | 0xC0A80101 | 11000000.10101000.00000001.00000001 | Private |
| 8.8.8.8 | 134744072 | 0x08080808 | 00001000.00001000.00001000.00001000 | Public |
| 255.255.255.255 | 4294967295 | 0xFFFFFFFF | 11111111.11111111.11111111.11111111 | Limited broadcast |
How 192.168.1.1 becomes 3232235777
| Byte | Value | Weight of the position | Value × weight |
|---|---|---|---|
| Byte 1 | 192 | 16,777,216 | 3,221,225,472 |
| Byte 2 | 168 | 65,536 | 11,010,048 |
| Byte 3 | 1 | 256 | 256 |
| Byte 4 | 1 | 1 | 1 |
| Sum | — | — | 3232235777 |
Legacy inet_aton spellings of 127.0.0.1
| You type | Rule | Read as | Flagged as unusual |
|---|---|---|---|
| 127.0.0.1 | Four parts: each one is a byte | 127.0.0.1 | No |
| 127.0.1 | Three parts: the last one fills the last two bytes | 127.0.0.1 | Yes |
| 127.1 | Two parts: the last one fills the last three bytes | 127.0.0.1 | Yes |
| 0x7f.1 | Hex parts start with 0x | 127.0.0.1 | Yes |
| 0x7F000001 | One part: the whole 32-bit address, here in hex | 127.0.0.1 | No |
| 2130706433 | One part: the whole 32-bit address, here in decimal | 127.0.0.1 | No |
| 0177.0.0.1 | A part with a leading 0 is octal | 127.0.0.1 | Yes |
| 017700000001 | One part in octal | 127.0.0.1 | Yes |
Special-use IPv6 address ranges
| Range | Name | First address | Last address | Addresses | Standard |
|---|---|---|---|---|---|
| ::/128 | Unspecified address | :: | :: | 1 | RFC 4291 |
| ::1/128 | Loopback | ::1 | ::1 | 1 | RFC 4291 |
| ::ffff:0:0/96 | IPv4-mapped address | ::ffff:0:0 | ::ffff:ffff:ffff | 2^32 = 4,294,967,296 | RFC 4291 |
| 64:ff9b::/96 | IPv4/IPv6 translation (NAT64) | 64:ff9b:: | 64:ff9b::ffff:ffff | 2^32 = 4,294,967,296 | RFC 6052 |
| 100::/64 | Discard-only | 100:: | 100::ffff:ffff:ffff:ffff | 2^64 = 18,446,744,073,709,551,616 | RFC 6666 |
| 2000::/3 | Global unicast | 2000:: | 3fff:ffff:ffff:ffff:ffff:ffff:ffff:ffff | 2^125 = 42,535,295,865,117,307,932,921,825,928,971,026,432 | RFC 4291 |
| 2001::/32 | Teredo tunnelling | 2001:: | 2001:0:ffff:ffff:ffff:ffff:ffff:ffff | 2^96 = 79,228,162,514,264,337,593,543,950,336 | RFC 4380 |
| 2001:db8::/32 | Documentation | 2001:db8:: | 2001:db8:ffff:ffff:ffff:ffff:ffff:ffff | 2^96 = 79,228,162,514,264,337,593,543,950,336 | RFC 3849 |
| 2002::/16 | 6to4 tunnelling | 2002:: | 2002:ffff:ffff:ffff:ffff:ffff:ffff:ffff | 2^112 = 5,192,296,858,534,827,628,530,496,329,220,096 | RFC 3056 |
| 3fff::/20 | Documentation | 3fff:: | 3fff:fff:ffff:ffff:ffff:ffff:ffff:ffff | 2^108 = 324,518,553,658,426,726,783,156,020,576,256 | RFC 9637 |
| fc00::/7 | Unique local address (ULA) | fc00:: | fdff:ffff:ffff:ffff:ffff:ffff:ffff:ffff | 2^121 = 2,658,455,991,569,831,745,807,614,120,560,689,152 | RFC 4193 |
| fe80::/10 | Link-local unicast | fe80:: | febf:ffff:ffff:ffff:ffff:ffff:ffff:ffff | 2^118 = 332,306,998,946,228,968,225,951,765,070,086,144 | RFC 4291 |
| fec0::/10 | Site-local (deprecated) | fec0:: | feff:ffff:ffff:ffff:ffff:ffff:ffff:ffff | 2^118 = 332,306,998,946,228,968,225,951,765,070,086,144 | RFC 3879 |
| ff00::/8 | Multicast | ff00:: | ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff | 2^120 = 1,329,227,995,784,915,872,903,807,060,280,344,576 | RFC 4291 |
IPv6 expand and compress examples
| Written as | Expanded | Compressed (RFC 5952) | What happens |
|---|---|---|---|
| 2001:0db8:0000:0000:0000:0000:0000:0001 | 2001:0db8:0000:0000:0000:0000:0000:0001 | 2001:db8::1 | Leading zeros are dropped and the longest run of zero groups becomes :: |
| 2001:db8:0:0:1:0:0:1 | 2001:0db8:0000:0000:0001:0000:0000:0001 | 2001:db8::1:0:0:1 | Two runs of equal length: the first one becomes :: |
| 2001:db8:0:1:0:0:0:1 | 2001:0db8:0000:0001:0000:0000:0000:0001 | 2001:db8:0:1::1 | Two runs: the longer one becomes :: |
| 2001:db8:0:1:1:1:1:1 | 2001:0db8:0000:0001:0001:0001:0001:0001 | 2001:db8:0:1:1:1:1:1 | A single zero group is written 0, never :: |
| 2001:DB8::ABCD | 2001:0db8:0000:0000:0000:0000:0000:abcd | 2001:db8::abcd | Hex digits are written in lowercase |
| 0:0:0:0:0:0:0:0 | 0000:0000:0000:0000:0000:0000:0000:0000 | :: | All groups zero: the unspecified address |
| 0:0:0:0:0:0:0:1 | 0000:0000:0000:0000:0000:0000:0000:0001 | ::1 | The loopback address |
| ::ffff:192.0.2.128 | 0000:0000:0000:0000:0000:ffff:c000:0280 | ::ffff:c000:280 | An IPv4 tail becomes two hex groups |
How to convert an IP address
- 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).
- 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.
- 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.
- 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).
- 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
- RFC 4291: IP Version 6 Addressing Architecture
- RFC 5952: A Recommendation for IPv6 Address Text Representation
- RFC 1918: Address Allocation for Private Internets
- RFC 6598: IANA-Reserved IPv4 Prefix for Shared Address Space
- RFC 5737: IPv4 Address Blocks Reserved for Documentation
- RFC 3849: IPv6 Address Prefix Reserved for Documentation
- RFC 3927: Dynamic Configuration of IPv4 Link-Local Addresses
- RFC 4193: Unique Local IPv6 Unicast Addresses
- RFC 6890: Special-Purpose IP Address Registries
- RFC 1035: Domain Names, Implementation and Specification (in-addr.arpa, section 3.5)
- RFC 3596: DNS Extensions to Support IP Version 6 (ip6.arpa)
- RFC 3056: Connection of IPv6 Domains via IPv4 Clouds (6to4)
- RFC 6052: IPv6 Addressing of IPv4/IPv6 Translators
- inet_aton(3), Linux manual page (the legacy address spellings)
- ipaddress, Python standard library documentation (reference values for the tests)
More free tools
- Hex CalculatorAdd, subtract, multiply, divide and AND, OR, XOR, NOT or shift hex numbers of any size, with 8 to 64-bit overflow, two’s complement and long-hand working.
- Network Ports ReferenceSearch common TCP and UDP port numbers by number, range or service name: 22 SSH, 443 HTTPS, 3306 MySQL and more, with secure variants and IANA status.
- Download Time CalculatorHow long a file takes to download at your speed, or the speed needed to finish in time. Handles bits vs bytes, MB vs MiB and protocol overhead.
- Text to Binary ConverterConvert text to binary, hex, octal or decimal bytes and back. UTF-8 by default (é is 2 bytes, an emoji 4) or UTF-16, with a per-character breakdown.
- Meta Tag GeneratorGenerate a copy-ready head snippet: title, description, canonical, robots, Open Graph and X card tags, with length checks and search and social previews.
- Regex TesterTest JavaScript regular expressions: highlighted matches, capture groups, replacements with $1 or $<name>. Stops runaway patterns. Runs in your browser.
More: Web, URLs, images and networkAll developer toolsAll toolsHome & DIY calculators