Audited ·Last updated 28 Jul 2026·6 citations·Tier 2·0 uses

IP Address Converter — Dotted Decimal, Integer, Hex & Binary

Convert an IPv4 address between dotted-decimal, 32-bit integer, hex, binary and octal. Also returns the reverse-DNS name and IPv4-mapped IPv6 form.

IP Address Converter

Input notation
A single IPv4 address written in the notation selected above. Do not append a /nn prefix — this page converts one address, it does not subnet. Binary may be written with or without dots between the octets.
Dotted decimal
192.168.1.1
The familiar four-octet form defined by the RFC 3986 §3.2.2 ABNF, where each octet is a decimal number from 0 to 255.
32-bit integer
3,232,235,777
Hexadecimal
0xC0A80101
Binary
11000000.10101000.00000001.00000001
Octal (inet_addr form)
0300.0250.01.01
Legacy address class
Class C (192.0.0.0–223.255.255.255) — legacy classful range, deprecated by CIDR (RFC 4632)
IPv4-mapped IPv6
::ffff:192.168.1.1
Reverse-DNS name
1.1.168.192.in-addr.arpa

Background.

This IP address converter takes one IPv4 address and rewrites it in every notation the address can legally wear: dotted decimal, a single unsigned 32-bit integer, hexadecimal, binary, and the zero-prefixed octal form that POSIX inet_addr() accepts. It also derives three things that fall out of the same 32 bits — the legacy class letter, the IPv4-mapped IPv6 address, and the in-addr.arpa reverse-DNS name. The notation selector works in both directions: paste 3232235777 and pick '32-bit integer' and you get 192.168.1.1 back, along with every other form.

The reason this is a calculator rather than a fact is that an IPv4 address is not really four numbers. RFC 791 §2.3 is blunt about it: "Addresses are fixed length of four octets (32 bits)." The dots are a human convenience layered on top of a single 32-bit integer, and the four-part written form only got a formal grammar much later, in the RFC 3986 §3.2.2 ABNF that bounds each dec-octet at 255. Everything on this page is that one integer, viewed through a different base.

The integer form is the one people actually come here for. If you have ever stored addresses in a database, you have met it: an INT UNSIGNED column holds an IPv4 address in four bytes instead of the fifteen characters a VARCHAR would need, and — far more importantly — it makes range queries work. GeoIP tables, abuse blocklists and CDN allowlists are all published as integer ranges precisely because BETWEEN on an integer is an index seek, while string comparison on '192.168.1.9' versus '192.168.1.10' sorts the wrong way round. MySQL exposes the same conversion as INET_ATON()/INET_NTOA(), PostgreSQL as a cast on the inet type, and Python as int(ipaddress.IPv4Address(...)).

The binary view earns its place for a different reason: subnet masks only make sense in binary. A /26 is 26 leading ones, and seeing 192.168.1.1 as 11000000.10101000.00000001.00000001 is what makes it obvious which bits the mask keeps. Hexadecimal is what you read in a packet capture, because two hex digits map exactly to one octet with no arithmetic in between.

The octal output exists as a warning. POSIX specifies that the parts of a dotted address "may be decimal, octal, or hexadecimal, as specified in the ISO C standard", so inet_addr("192.168.010.1") is 192.168.8.1, not 192.168.10.1. Modern parsers in Go, Python 3.9.5+ and Rust reject leading zeros outright; C, PHP and many embedded stacks still read them as octal. Because the two answers disagree, this converter refuses a dotted address with a leading zero rather than guessing, and tells you to use the octal mode if octal is what you meant.

Below the widget you will find the octet arithmetic written out, a note on why this page uses exact decimal arithmetic instead of JavaScript's bitwise operators (they silently produce negative numbers above 2,147,483,647), the classful history and why RFC 4632 deprecated it, and how the reverse-DNS and IPv4-mapped IPv6 forms are built. This page converts one bare address; for prefixes, masks, network and broadcast addresses use the IP subnet calculator and the CIDR-to-netmask converter linked below.

What is ip address converter?

An IPv4 address is a 32-bit unsigned integer that identifies an interface on an IP network. RFC 791, the 1981 specification of the Internet Protocol, defines it as four octets — 32 bits — and nothing in the protocol itself says anything about dots. The dotted-decimal notation everyone writes (192.168.1.1) is a convention for humans: split the 32 bits into four 8-bit groups, print each group in decimal, and separate them with full stops. Because 8 bits can hold 0 through 255, each of the four numbers is bounded at 255, which is exactly what the RFC 3986 §3.2.2 ABNF encodes with its `dec-octet` rule.

Once you accept that the address is one number, converting it is just a change of base. The integer value is o0 x 16,777,216 + o1 x 65,536 + o2 x 256 + o3, so 192.168.1.1 is 3,221,225,472 + 11,010,048 + 256 + 1 = 3,232,235,777. Writing that number in base 16 gives 0xC0A80101 (two hex digits per octet); in base 2 it gives 11000000.10101000.00000001.00000001; in base 8, octet by octet with a leading zero, it gives 0300.0250.01.01.

Three derived forms come from the same bits. The legacy class letter is read off the leading bits of the first octet — RFC 791 defines class A as leading bit 0, class B as 10, class C as 110, with D (multicast) and E (reserved) added later. The IPv4-mapped IPv6 address places the 32 bits after 80 zero bits and a 16-bit FFFF field, written ::ffff:192.168.1.1 under the RFC 4291 §2.2 mixed notation. The reverse-DNS name reverses the octets and appends in-addr.arpa, so 10.2.0.52 becomes 52.0.2.10.in-addr.arpa — RFC 1035 §3.5 admits the reversal is "awkward to read" but explains it "allows zones to be delegated which are exactly one network of address space".

How to use this calculator.

  1. Choose the notation you are starting from. 'Dotted decimal' is the everyday form (192.168.1.1); '32-bit integer' is the single number a database or GeoIP table stores; 'Hexadecimal' is what you read in a packet capture; 'Binary' is the 32-bit view you need for subnet masks.
  2. Type or paste the address into the field. Do not include a /nn prefix — this page converts one address. If you need network and broadcast addresses, use the IP subnet calculator linked in the related tools.
  3. Read the dotted-decimal result first: whatever notation you started from, this is the canonical form. Every other output is the same 32 bits in a different base.
  4. Use the 32-bit integer when you need to store or range-query addresses. It is the value MySQL's INET_ATON() returns and the value an INT UNSIGNED column holds in four bytes.
  5. Use the binary output when you are working out a subnet by hand. Count the leading bits your mask keeps and everything to the right is host space.
  6. Use the reverse-DNS name when you are creating or debugging a PTR record — that is the exact name a resolver queries when it reverse-looks-up the address.
  7. Hexadecimal may be entered with or without the 0x prefix and shorter than eight digits: 0xFFFF is read as 0.0.255.255. Binary may be entered with or without dots between the octets, but must be exactly 32 bits.

The formula.

value = ((o₀·256 + o₁)·256 + o₂)·256 + o₃

Forward conversion (dotted decimal to integer) is positional notation in base 256:

value = ((o₀ × 256 + o₁) × 256 + o₂) × 256 + o₃ = o₀ × 16,777,216 + o₁ × 65,536 + o₂ × 256 + o₃

For 10.20.30.40: 10 × 16,777,216 = 167,772,160; 20 × 65,536 = 1,310,720; 30 × 256 = 7,680; plus 40. The sum is 169,090,600.

Reverse conversion (integer to dotted decimal) divides back out:

o₀ = ⌊value / 16,777,216⌋ mod 256 o₁ = ⌊value / 65,536⌋ mod 256 o₂ = ⌊value / 256⌋ mod 256 o₃ = value mod 256

Hexadecimal is the same integer in base 16, zero-padded to eight digits, and because 16² = 256 each octet maps to exactly two hex digits with no carrying between them: 10 → 0A, 20 → 14, 30 → 1E, 40 → 28, giving 0x0A141E28. Binary is base 2 per octet, zero-padded to eight bits: 00001010.00010100.00011110.00101000. Octal is base 8 per octet with a leading zero — note that the octal form is not fixed width, so octet 1 prints as 01 and octet 192 prints as 0300.

One implementation note that matters more than it looks. JavaScript's bitwise operators (&, |, >>>, <<) coerce their operands to *signed* 32-bit integers, so the perfectly ordinary address 192.168.1.1 — value 3,232,235,777, above 2³¹ − 1 = 2,147,483,647 — comes back as −1,062,731,519 the moment you touch it with a bitwise operator. This calculator uses no bitwise operators at all. Every step is exact integer arithmetic (floor-divide, multiply, modulo) in Decimal.js, so addresses in the upper half of the space behave identically to addresses in the lower half. If you are writing this conversion yourself in JavaScript, use multiplication and division, or the unsigned shift >>> 0 to correct the sign afterwards.

The class lookup is a pure range test on the first octet: 0–127 class A, 128–191 class B, 192–223 class C, 224–239 class D (multicast), 240–255 class E (reserved). RFC 791 §2.3 defines A, B and C by their leading bits — 0, 10 and 110 — and D and E were added by later documents. RFC 4632 chose to "deprecate the Class A/B/C network address assignment system in favor of using 'classless', hierarchical blocks of IP addresses (referred to as prefixes)", so this output is a historical lookup only; nothing in modern routing consults it.

A worked example.

Example

Take 10.20.30.40, an address inside the RFC 1918 private 10/8 block that a lot of corporate VPNs hand out. All four octets are in range and none has a leading zero, so the conversion proceeds. The 32-bit value is 10 × 16,777,216 + 20 × 65,536 + 30 × 256 + 40 = 167,772,160 + 1,310,720 + 7,680 + 40 = 169,090,600 — that is the number an INT UNSIGNED column would store, and the number MySQL's INET_ATON('10.20.30.40') returns. In hexadecimal it is 0x0A141E28: 10 is 0A, 20 is 14, 30 is 1E, 40 is 28, and you can check the whole thing by expansion, since 0x0A000000 = 167,772,160, 0x00140000 = 1,310,720, 0x00001E00 = 7,680 and 0x00000028 = 40, summing back to 169,090,600. In binary it is 00001010.00010100.00011110.00101000 — 10 is 8+2, 20 is 16+4, 30 is 16+8+4+2 and 40 is 32+8 — which is the form you would stare at to see that a /12 mask on this address keeps the first twelve bits, 00001010.0001, and hands the rest to hosts. In octal it is 012.024.036.050, and that is worth a moment: type 012.024.036.050 into a C program's inet_addr() and you get 10.20.30.40 back, but type 010.020.030.040 into a browser and you may get 8.16.24.32 instead, because the leading zeros make each part octal. The first octet is 10, which is 127 or below, so the leading bit is 0 and the legacy class is A — a label that means nothing operationally since RFC 4632, because 10/8 is a CIDR prefix, not a class A network. Wrapped into IPv6 the address becomes ::ffff:10.20.30.40, and its reverse-DNS name, with the octets flipped, is 40.30.20.10.in-addr.arpa — the exact name a resolver queries for the PTR record.

address Text10.20.30.40
input Formatdotted

Frequently asked questions.

How do I convert an IP address to a decimal number?
Multiply each octet by its place value in base 256 and add: value = o₀ × 16,777,216 + o₁ × 65,536 + o₂ × 256 + o₃. For 192.168.1.1 that is 192 × 16,777,216 = 3,221,225,472, plus 168 × 65,536 = 11,010,048, plus 1 × 256 = 256, plus 1, giving 3,232,235,777. The result is always between 0 and 4,294,967,295 because an IPv4 address is 32 bits. Databases and command-line tools expose the same conversion under different names: MySQL INET_ATON(), PostgreSQL's inet type cast, Python int(ipaddress.IPv4Address('192.168.1.1')), and PHP ip2long() — though note ip2long() returns a signed integer on 32-bit builds and can therefore come back negative.
Why would anyone store an IP address as an integer?
Two reasons: size and range queries. Four bytes in an INT UNSIGNED column instead of up to fifteen characters in a VARCHAR is the smaller win. The bigger one is that integer comparison sorts correctly and uses an index, while string comparison does not — as text, '192.168.1.10' sorts before '192.168.1.9', which quietly breaks any BETWEEN. Every GeoIP database, abuse blocklist and CDN allowlist is published as start/end integer pairs for exactly this reason: 'which country is this address in?' becomes a single indexed range seek rather than a table scan.
Why does my converter return a negative number for addresses above 128.0.0.0?
Because the code used a bitwise operator. JavaScript's &, |, ^, << and >> coerce both operands to signed 32-bit integers, so any address whose value exceeds 2,147,483,647 — that is, anything from 128.0.0.0 upward — wraps to a negative number. 192.168.1.1 becomes −1,062,731,519. PHP's ip2long() has the same behaviour on 32-bit builds. The fixes are to append >>> 0 (the unsigned right shift is the one operator that returns an unsigned result), to use multiplication and division instead of shifts, or, as this calculator does, to do the whole conversion in exact decimal arithmetic and never touch a bitwise operator.
Is 192.168.010.1 the same address as 192.168.10.1?
Not reliably, and that ambiguity is a real security bug class. POSIX specifies for inet_addr() that "All numbers supplied as parts in IPv4 dotted decimal notation may be decimal, octal, or hexadecimal, as specified in the ISO C standard", so a leading zero makes the part octal: 010 is 8, and 192.168.010.1 resolves to 192.168.8.1. C, PHP and many embedded network stacks still behave this way. Go, Rust and Python 3.9.5 and later reject leading zeros instead of interpreting them. Because a validator and a resolver can therefore disagree about which host an address points to, this converter refuses a dotted address containing a leading zero and asks you to use the octal notation mode if octal is what you meant.
What are IP address classes, and does my address still have one?
RFC 791 §2.3 split the address space by the leading bits of the first octet: leading 0 is class A (0–127), 10 is class B (128–191), 110 is class C (192–223); class D (224–239, multicast) and class E (240–255, reserved) were added later. Your address still falls in one of those ranges arithmetically, but the classification has had no operational meaning since 1993, when RFC 4632 chose to "deprecate the Class A/B/C network address assignment system in favor of using 'classless', hierarchical blocks of IP addresses (referred to as prefixes)". Under CIDR the split between network and host is set by an explicit prefix length such as /26, not by the first octet. This page reports the class because exam questions and legacy documentation still ask for it — do not route on it.
What is the in-addr.arpa name for and how is it built?
It is the DNS name that holds the reverse lookup for an address. Write the four octets in reverse order, join them with dots, and append in-addr.arpa: 10.2.0.52 becomes 52.0.2.10.in-addr.arpa. A resolver asked for the hostname of an address queries the PTR record at that name. RFC 1035 §3.5 concedes that "The reversal, though awkward to read, allows zones to be delegated which are exactly one network of address space" — DNS delegates left to right and IP addresses are hierarchical left to right, so one of them has to be flipped for a /8, /16 or /24 to map onto a single delegable zone.
What does ::ffff:192.168.1.1 mean?
It is the IPv4-mapped IPv6 address defined in RFC 4291 §2.5.5.2 — 80 zero bits, then a 16-bit field of all ones (FFFF), then the original 32 IPv4 bits. It is how a dual-stack socket represents an IPv4 peer when the application is holding an IPv6 socket, which is why an IPv6-listening web server logs IPv4 clients in this form. The trailing dotted-quad spelling comes from the RFC 4291 §2.2 mixed notation x:x:x:x:x:x:d.d.d.d. Note that an IPv4-mapped address is not a routable IPv6 address and is not the same thing as an IPv4-compatible address (::192.168.1.1), which is deprecated.
Can this page subnet an address or convert a CIDR prefix?
No, deliberately. This converter takes one bare address and changes its notation; entering 192.168.1.1/24 is rejected with a message pointing you elsewhere. Network address, broadcast address, first and last usable host and the usable-host count all depend on a prefix, and they live on the IP subnet calculator. Prefix-to-mask lookups in both directions (/26 ⇄ 255.255.255.192, plus wildcard and hex masks) live on the CIDR-to-netmask converter. Keeping the three separate means each page answers one question completely rather than three questions partially.

References& sources.

  1. [1]Postel, J. (ed.) (1981). RFC 791, Internet Protocol — DARPA Internet Program Protocol Specification, §2.3 Function Description and §3.2 Discussion. "Addresses are fixed length of four octets (32 bits)." The same section defines the classful split by leading bits: "in class a, the high order bit is zero … in class b, the high order two bits are one-zero … in class c, the high order three bits are one-one-zero". Source for the 32-bit width and the legacy class output.
  2. [2]Berners-Lee, T., Fielding, R. & Masinter, L. (2005). RFC 3986, Uniform Resource Identifier (URI): Generic Syntax, §3.2.2 Host. Gives the formal ABNF for dotted-decimal notation — IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet — with dec-octet bounded at "25" %x30-35, i.e. 0–255. Source for the per-octet range this calculator enforces.
  3. [3]IEEE and The Open Group (2018). IEEE Std 1003.1-2017 (POSIX.1-2017), System Interfaces: inet_addr(). Specifies the a.b.c.d, a.b.c, a.b and a forms, and states that "All numbers supplied as parts in IPv4 dotted decimal notation may be decimal, octal, or hexadecimal, as specified in the ISO C standard". Source for the octal output and for rejecting leading zeros in dotted input.
  4. [4]Hinden, R. & Deering, S. (2006). RFC 4291, IP Version 6 Addressing Architecture, §2.2 Text Representation of Addresses and §2.5.5.2 IPv4-Mapped IPv6 Address. Defines the 80-zero-bits + FFFF + IPv4 layout and the mixed textual form x:x:x:x:x:x:d.d.d.d, with the example ::FFFF:129.144.52.38. Source for the IPv4-mapped IPv6 output.
  5. [5]Mockapetris, P. (1987). RFC 1035, Domain Names — Implementation and Specification, §3.5 IN-ADDR.ARPA domain. "Thus data for Internet address 10.2.0.52 is located at domain name 52.0.2.10.IN-ADDR.ARPA"; "The reversal, though awkward to read, allows zones to be delegated which are exactly one network of address space." Source for the reverse-DNS output.
  6. [6]Fuller, V. & Li, T. (2006). RFC 4632, Classless Inter-domain Routing (CIDR): The Internet Address Assignment and Aggregation Plan, §2 and §3.1. Records the decision to "deprecate the Class A/B/C network address assignment system in favor of using 'classless', hierarchical blocks of IP addresses (referred to as prefixes)". Source for labelling the class output as legacy.

In this category

Embed

Quanta Pro

Paid features are coming later.

  • All 590 calculators remain free
  • No billing is enabled
Coming soon