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

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

Convert one IPv4 address between dotted decimal, 32-bit integer, hex and binary; also get octal, the legacy class, the in-addr.arpa name and the ::ffff: 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 address as four decimal octets from 0 to 255 separated by dots, the everyday form.
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.

Ask MySQL's INET_ATON() for 192.168.1.1 and it answers 3232235777. That number is not a code for the address; it is the address. RFC 791, the 1981 specification of the Internet Protocol, defines an address as four octets — 32 bits — and the dotted form is only a readable way to print them: each 8-bit group written in decimal, with a full stop between groups. Read the 32 bits as one unsigned number and you have the integer; write them four bits to a digit and you have hexadecimal; write every bit and you have binary. The converter moves between these in either direction.

Each notation lives somewhere different. The integer is what an unsigned 32-bit database column stores and what IP-range tables list, because numbers sort and compare correctly where text does not: as strings, "192.168.1.10" sorts before "192.168.1.9". Hexadecimal turns up in packet dumps and some logs, two digits to an octet. Binary is the view that makes subnet masks legible, since a /24 keeps exactly the first 24 bits.

Three more forms come from the same bits. The reverse-DNS name lists the octets backwards under in-addr.arpa, the name a resolver queries to find the hostname for an address. The IPv4-mapped IPv6 form, ::ffff: followed by the dotted address, is how dual-stack software shows an IPv4 client. The legacy class letter, read from the first octet, survives in textbooks and exams although the Internet moved to classless addressing in 1993.

The octal output is there as a warning. Under POSIX, inet_addr() reads any part that starts with 0 as octal, so 010 means 8, while other software reads the same text as decimal 10 or rejects it. Because the two readings point at different hosts, a dotted address with a leading zero is refused rather than guessed at.

What is ip address converter?

An IPv4 address is a 32-bit unsigned number, from 0 to 4,294,967,295, that identifies a network interface. Dotted-decimal notation splits those bits into four octets of eight bits and writes each as a decimal number from 0 to 255; RFC 3986 gives the formal grammar, which caps every part at 255. With 2³² possible values the whole IPv4 space holds about 4.3 billion addresses, and each one has exactly one dotted form, one eight-digit hexadecimal form and one 32-bit binary form.

How to use this calculator.

  1. Set the input notation to match what you have: dotted decimal (192.168.1.1), the 32-bit integer (3232235777), hexadecimal (0xC0A80101) or binary.
  2. Paste the address on its own. A /24 or any other prefix is rejected; network and broadcast addresses belong to the IP subnet calculator.
  3. Hexadecimal can be typed with or without 0x and with fewer than eight digits, which are padded on the left, so 0xFFFF becomes 0.0.255.255. Binary must be exactly 32 ones and zeros, with or without dots between the octets.
  4. In dotted input, drop leading zeros: write 192.168.10.1, not 192.168.010.1.
  5. Copy the form you need: the integer for a database or range table, the in-addr.arpa name for a PTR record, the binary when working out a mask by hand.

The formula.

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

Dotted decimal to integer is place value in base 256: value = o₀ × 16,777,216 + o₁ × 65,536 + o₂ × 256 + o₃, where o₀ is the first octet and 16,777,216 is 256³. Going back, each octet is the integer divided by its place value, rounded down, then reduced modulo 256: o₀ = ⌊value ÷ 16,777,216⌋ mod 256, and so on down to o₃ = value mod 256. Hexadecimal is the same integer in base 16, padded to eight digits; because 16² = 256, every octet maps to exactly two hex digits with no carrying between them. Binary writes each octet in base 2, padded to eight bits. The octal form writes each octet in base 8 behind a leading 0, so it has no fixed width: 0 prints as 00, 1 as 01 and 192 as 0300. The class is read from the first octet alone: 0–127 is A, 128–191 B, 192–223 C, 224–239 D (multicast) and 240–255 E (reserved), matching RFC 791's leading-bit rule of 0 for A, 10 for B and 110 for C.

A worked example.

Example

Take 10.20.30.40, an address in the 10.0.0.0/8 block that RFC 1918 sets aside for private networks. Its octets are 10, 20, 30 and 40, so the integer is 10 × 16,777,216 + 20 × 65,536 + 30 × 256 + 40 = 167,772,160 + 1,310,720 + 7,680 + 40 = 169,090,600. In hexadecimal each octet becomes two digits — 10 is 0A, 20 is 14, 30 is 1E and 40 is 28 — giving 0x0A141E28. In binary the octets read 00001010.00010100.00011110.00101000, and in octal 012.024.036.050. The first octet, 10, is below 128, so the legacy class is A. Wrapped for IPv6 the address is ::ffff:10.20.30.40, and reversed for DNS it is 40.30.20.10.in-addr.arpa. The octal line shows why leading zeros cause trouble. A C program passing "012.024.036.050" to inet_addr() gets 10.20.30.40 back, but "010.020.030.040" would come back as 8.16.24.32.

address Text10.20.30.40
input Formatdotted

Frequently asked questions.

How do I turn a dotted IP address into a single decimal number by hand?
Multiply the octets by 16,777,216, 65,536, 256 and 1 and add. For 192.168.1.1 that is 3,221,225,472 + 11,010,048 + 256 + 1 = 3,232,235,777. MySQL's INET_ATON() does the same sum, and INET_NTOA() turns the integer back into dotted form.
Why does my JavaScript IP conversion return a negative number?
JavaScript's bitwise operators treat their operands as signed 32-bit integers, so any address from 128.0.0.0 upward, whose value exceeds 2,147,483,647, wraps negative: 192.168.1.1 comes out as −1,062,731,519. Appending >>> 0 converts the result back to unsigned, or you can use ordinary multiplication and division instead of shifts.
Is 192.168.010.1 the same address as 192.168.10.1?
It depends on the parser, which is the problem. POSIX inet_addr() reads 010 as octal 8, giving 192.168.8.1. Other code reads it as decimal 10, and Python's ipaddress module has rejected leading zeros since version 3.9.5. The converter refuses the ambiguous form, so remove the zero and enter the decimal value you mean.
Why is the reverse-DNS name written backwards?
DNS names grow more general from left to right, while IP addresses grow more specific. RFC 1035 explains that reversing the octets, "though awkward to read, allows zones to be delegated which are exactly one network of address space": 10.in-addr.arpa covers all of 10.0.0.0/8 and can be handed to one operator.
What does ::ffff: in front of an IPv4 address mean?
It is the IPv4-mapped IPv6 address from RFC 4291: 80 zero bits, 16 one bits, then the 32 IPv4 bits. Servers listening on an IPv6 socket often log IPv4 visitors this way. It is not the same as the deprecated IPv4-compatible form, ::a.b.c.d, which has no ffff.
Does the class of an IP address still matter?
Not for routing. Classless Inter-Domain Routing replaced the class A/B/C scheme in 1993, and RFC 4632 restated that decision in 2006; prefix lengths such as /20 now set the network boundary. The ranges still carry meaning at the top end, where 224–239 is multicast and 240–255 is reserved.
Can a bare number like 2130706433 be used as an address?
With software that follows POSIX inet_addr(), yes: it accepts a single number as the whole 32-bit value, and 2130706433 is 127.0.0.1, the loopback address. A blocklist that only recognises the dotted spelling can therefore miss it, which is why security filters should convert addresses to integers before comparing.

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.

How this page was produced

Published by
Quanta Calculator
Primary sources
6 cited below
Method
value = ((o₀·256 + o₁)·256 + o₂)·256 + o₃
Published
Last verified

Built with AI assistance and verified by automated tests against the cited sources — every worked example on this page is computed by the same code that runs the calculator. How we build and check calculators.

In this category

Embed

Quanta Pro

Paid features are coming later.

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