IPv4 Address Converter: IP to Decimal, Binary & Hex

🔄

IPv4 Address Converter

4-in-1 multi-directional converter — IPv4 • Binary • Decimal • Hex — results update as you type

⚡ Try:

📊 Converted Values

⌨️

Waiting for valid input…

Select a mode, start typing — results appear instantly.

About This IPv4 Address Converter

This IPv4 Address Converter is a free, browser-based 4-in-1 bidirectional tool that instantly translates any valid IPv4 address between four distinct numeric representations: Dotted-Decimal (the standard human-readable form), Binary (the native 32-bit form used by routers and network hardware), Decimal Integer (the single 32-bit unsigned integer used by operating systems and programming APIs), and Hexadecimal (the base-16 compact form used in low-level networking and packet analysis).

Every conversion is calculated entirely in the browser as you type, with no server round-trips, and each result is accompanied by a fully visible, step-by-step academic calculation breakdown that mirrors the methods taught in Cisco Networking Academy (NetAcad) and university-level networking courses.

Whether you are preparing for the Cisco CCNA examination, studying for CompTIA Network+, or simply need a reliable real-time format translator, this tool provides both the correct answer and the educational reasoning behind every single result.

IPv4 Address Structure

Every IPv4 address is fundamentally a 32-bit binary number.

To make these addresses readable by humans, those 32 bits are divided into four equal groups of 8 bits each, called octets.

Each octet is converted independently from binary to decimal and the four resulting decimal numbers are then written side by side, separated by dots — producing the familiar dotted-decimal notation that everyone recognises, such as 192.168.1.1.

Because each octet is exactly 8 bits wide, it can represent any value from 0 (binary 00000000) to 255 (binary 11111111). This means any valid IPv4 address must have all four octets within the range 0–255.

The full 32-bit address space allows for 232 unique address values, which equals exactly 4,294,967,296 possible IPv4 addresses.

In all format conversion calculations, the four-octet structure is the central unit of work: you always process one octet at a time, independently of the others, whether you are converting to binary, to hexadecimal, or rebuilding the dotted-decimal form from another format.

Property Value
Total bits 32
Number of octets 4
Bits per octet 8
Octet range (decimal) 0 to 255
Total address space 232 = 4,294,967,296
Separator character Dot ( . ) in dotted-decimal notation

Binary Place Values: 128-64-32-16-8-4-2-1

Before performing any IPv4-to-binary conversion, you must understand the binary positional weight system that governs every 8-bit octet.

In binary (base 2), each bit position carries a fixed decimal weight that is a power of 2, and the weights are assigned from right to left — the rightmost bit (bit 0) carries the lowest weight of 20 = 1, and the leftmost bit (bit 7) carries the highest weight of 27 = 128. Reading the eight bit positions from left to right, the positional weights are: 128 · 64 · 32 · 16 · 8 · 4 · 2 · 1. A bit set to 1 contributes its full positional weight to the decimal total; a bit set to 0 contributes nothing.

The sum of all weights for an all-ones octet (11111111) is 128+64+32+16+8+4+2+1 = 255, which is the maximum value of any single octet.

Cisco NetAcad teaches this rule as the foundation of all IPv4 binary conversion and it is the single most important table to memorise for both the CCNA examination and real-world network troubleshooting.

Bit position (left → right) 7 6 5 4 3 2 1 0
Decimal weight 128 64 32 16 8 4 2 1
Power of 2 27 26 25 24 23 22 21 20

How to Convert IPv4 to Binary

Converting an IPv4 address to binary uses the subtractive positional weight method taught in the Cisco CCNA curriculum, applied independently to each of the four octets. The academic process has three stages for every octet:

Stage 1 — Isolate the octet value. Split the dotted-decimal address at the dots to obtain four separate decimal numbers, each between 0 and 255. Stage 2 — Apply the 128-64-32-16-8-4-2-1 rule. Work through the eight bit positions from left (128) to right (1). For each weight, ask: is the current remaining value ≥ this weight? If yes, write a 1, subtract the weight from the remaining value, and move to the next position. If no, write a 0 and move on without subtracting. Repeat until all eight positions are filled.

Stage 3 — Pad to 8 bits and join. If the binary result has fewer than 8 digits (which happens for small values such as 10), left-pad with zeros until the string is exactly 8 characters. After all four octets are converted, join the four 8-bit groups with dots to produce the final binary notation.

For example, to convert octet 192: 192 ≥ 128 → write 1, remainder 64; 64 ≥ 64 → write 1, remainder 0; 0 < 32 → write 0; 0 < 16 → write 0; 0 < 8 → write 0; 0 < 4 → write 0; 0 < 2 → write 0; 0 < 1 → write 0 — giving 11000000.

How to Convert Binary to IPv4

Converting from binary back to dotted-decimal IPv4 is the exact reverse of the process described above and follows four clear steps.

Step 1 — Accept the input. The binary IPv4 address may arrive as four dot-separated 8-bit groups (e.g., 11000000.10101000.00000001.00000001) or as one continuous 32-bit string of zeros and ones (11000000101010000000000100000001). Both formats are equivalent; if given the continuous form, split it into four consecutive 8-character groups.

Step 2 — Process each 8-bit octet independently. For each of the four 8-bit groups, align the bits against the weight table (128 · 64 · 32 · 16 · 8 · 4 · 2 · 1).

Step 3 — Multiply and sum. For every bit position that contains a 1, add that position's weight to a running total; bits containing 0 contribute nothing. The final sum is the decimal value of that octet, which will always fall between 0 and 255.

Step 4 — Join with dots. After calculating the decimal value of all four octets, join them with dot separators to produce the complete dotted-decimal IPv4 address. For example, the binary octet 10101000 gives: 128×1 + 64×0 + 32×1 + 16×0 + 8×1 + 4×0 + 2×0 + 1×0 = 128 + 32 + 8 = 168.

How to Convert IPv4 to Decimal Integer

Beyond the familiar dotted-decimal format, an IPv4 address can be expressed as a single 32-bit unsigned integer — a whole number between 0 and 4,294,967,295.

This representation is used internally by operating systems, socket APIs (e.g., the C inet_addr() function), and many database systems that store IP addresses in integer columns for fast indexed lookups. The academic conversion method is the base-256 polynomial formula:

Decimal Integer = (Octet1 × 2563) + (Octet2 × 2562) + (Octet3 × 2561) + (Octet4 × 2560)

Here each octet is treated as one "digit" in a base-256 positional number system, where the positional weights are powers of 256 (since each octet holds exactly 8 bits, and 28 = 256). Expanding the powers: 2563 = 16,777,216; 2562 = 65,536; 2561 = 256; 2560 = 1. The first octet carries the greatest weight because it represents the most-significant byte of the 32-bit integer.

Applying this to 192.168.1.1: (192 × 16,777,216) + (168 × 65,536) + (1 × 256) + (1 × 1) = 3,221,225,472 + 11,010,048 + 256 + 1 = 3,232,235,777. This is exactly the value this tool displays in its Decimal output for that address.

How to Convert Decimal Integer to IPv4

Given a 32-bit unsigned integer n (any value from 0 to 4,294,967,295), the academic method for recovering the four octets uses successive bitwise right-shift and mask operations, which is the technique used inside the tool's step-by-step calculations. The operations work by isolating each 8-bit segment of the 32-bit integer in turn:

Octet 1 (most significant) = (n >>> 24) & 255 — shift the integer 24 positions to the right so bits 31–24 are now in positions 7–0, then mask with 255 (binary 11111111) to keep only those 8 bits. Octet 2 = (n >>> 16) & 255. Octet 3 = (n >>> 8) & 255. Octet 4 (least significant) = n & 255 — no shift needed; just mask the lowest 8 bits directly.

An equivalent academic approach that avoids bitwise operators is successive division and modulo by 256: compute n mod 256 to get Octet 4, then set n = floor(n / 256) and repeat three more times to get octets 3, 2, and 1 in reverse order. Both methods always produce identical results. After extracting all four values, join them with dots to form the dotted-decimal IPv4 address.

How to Convert IPv4 to Hexadecimal

Hexadecimal (base 16) is widely used in low-level networking contexts — packet capture tools, ARP tables, embedded firmware, and Cisco IOS debug ip packet output often display IP addresses in hex.

Converting an IPv4 address to hexadecimal is straightforward because each octet (0–255) maps exactly to two hexadecimal digits (00 to FF), with no ambiguity or remainder. The academic method has three steps. Step 1 — Split into four octets. Separate the dotted-decimal address at the dots to obtain four decimal integers.

Step 2 — Convert each octet to a 2-digit hex pair. Divide the decimal octet value by 16 to find the high hex digit (the quotient), then take the remainder as the low hex digit. Look up the hex digit in the standard mapping: 0–9 stay as 0–9, and 10–15 become A–F respectively.

If either digit is a single character (which happens when the value is less than 16), left-pad with a zero to maintain exactly two characters. For example, decimal 192: 192 ÷ 16 = 12 remainder 0 → high digit C, low digit 0 → C0. Decimal 168: 168 ÷ 16 = 10 remainder 8 → high digit A, low digit 8 → A8.

Step 3 — Concatenate with 0x prefix. Join the four 2-digit hex pairs in order and prepend the conventional 0x prefix to signal hexadecimal notation, producing a final result of exactly 10 characters (e.g., 0xC0A80101).

How to Convert Hexadecimal to IPv4

Recovering a dotted-decimal IPv4 address from its hexadecimal representation is a precise four-step process. Step 1 — Strip the prefix. Remove the leading 0x, 0X, or # prefix if present, leaving exactly 8 hexadecimal characters. If the string is shorter than 8 characters, left-pad with zeros to reach exactly 8.

Step 2 — Split into four 2-character pairs. Reading left to right, divide the 8-character string into four consecutive pairs: characters 1–2 form the first pair, characters 3–4 form the second, characters 5–6 the third, and characters 7–8 the fourth. Each pair represents one octet of the IPv4 address.

Step 3 — Convert each hex pair to decimal. For each 2-character hex pair, treat the left character as the high digit and the right character as the low digit. The decimal value is: (high digit × 16) + low digit, where the letter digits A=10, B=11, C=12, D=13, E=14, F=15. For example, the hex pair C0: C = 12, 0 = 0 → (12 × 16) + 0 = 192. The pair A8: A = 10, 8 = 8 → (10 × 16) + 8 = 168.

Step 4 — Join with dots. Place the four resulting decimal numbers in order, separated by dots, to produce the complete IPv4 address.

What Does the CIDR Prefix Mean?

CIDR stands for Classless Inter-Domain Routing and the prefix notation — a forward slash followed by a number between 0 and 32 — is simply a compact way to indicate how many of the 32 bits in an IPv4 address are dedicated to identifying the network, with the remaining bits identifying the individual host within that network.

For example, the notation 192.168.1.1/24 means that the first 24 bits represent the network portion and the remaining 8 bits represent the host identifier. The CIDR prefix is a routing concept that belongs to subnetting; it is not part of the IPv4 address value itself.

This tool accepts a CIDR suffix as a convenient input (so you can paste an address directly from a router configuration without manually stripping the prefix), but it uses only the address portion (192.168.1.1) when calculating the Binary, Decimal, and Hexadecimal outputs. The prefix length is displayed in a hint for reference but plays no role in any of the four format conversions.

Full subnet calculations — network address, broadcast address, wildcard mask, usable host range — belong to a dedicated subnet calculator and are deliberately outside the scope of this format-conversion tool.

IPv4 Classes and Address Types

Before CIDR was introduced in 1993, IPv4 addresses were organised into five fixed classful ranges determined entirely by the value of the first octet. Understanding these classes remains an important baseline for the CCNA examination and for interpreting what the tool's address-type badge is communicating. The five classes and their first-octet ranges are:

  • Class A (first octet 0–127): Originally assigned to very large organisations and governments. The first octet identifies the network and the remaining three octets identify the host. The entire block provides 224 host addresses per network.
  • Class B (first octet 128–191): Assigned to medium-to-large organisations. The first two octets identify the network and the last two identify the host, providing 216 host addresses per network.
  • Class C (first octet 192–223): The most common class for smaller organisations. The first three octets identify the network and only the last octet identifies the host, providing a maximum of 28 − 2 = 254 usable host addresses per network.
  • Class D (first octet 224–239): Reserved exclusively for IP multicast groups. Addresses in this range are never assigned to individual hosts and cannot be used as source addresses in standard unicast packets.
  • Class E (first octet 240–255): Reserved by IANA for experimental and future use. These addresses are not routed on the public Internet.

Beyond the class system, several specific address ranges carry special meanings that networking engineers must recognise.

Private addresses (RFC 1918) are three reserved ranges — 10.0.0.0/8, 172.16.0.0–172.31.255.255, and 192.168.0.0/16 — that can be freely used inside private networks but are never routed across the public Internet.

Loopback addresses are the entire 127.0.0.0/8 block; packets sent to any address in this range (most commonly 127.0.0.1) are processed entirely within the host's own network stack without leaving the device, making them invaluable for testing local services.

APIPA (Automatic Private IP Addressing) occupies the 169.254.0.0/16 range; an operating system assigns itself an APIPA address automatically when it is configured for DHCP but fails to reach a DHCP server, which is why seeing a 169.254.x.x address in ipconfig or ifconfig output is a reliable diagnostic indicator of a failed DHCP lease.

Step-by-Step Examples

Example: Convert 192.168.1.10 to Binary, Hexadecimal, and Decimal Integer

Step 1 — Split into four octets. The address 192.168.1.10 gives four values: Octet 1 = 192, Octet 2 = 168, Octet 3 = 1, Octet 4 = 10. All four are processed independently in the steps below.

Step 2 — Convert each octet to 8-bit Binary using the 128-64-32-16-8-4-2-1 rule.

Octet Dec 128 64 32 16 8 4 2 1 Binary
Octet 1 192 1 1 0 0 0 0 0 0 11000000
Octet 2 168 1 0 1 0 1 0 0 0 10101000
Octet 3 1 0 0 0 0 0 0 0 1 00000001
Octet 4 10 0 0 0 0 1 0 1 0 00001010

Binary result: 11000000.10101000.00000001.00001010

Step 3 — Convert each octet to Hexadecimal. Divide each decimal octet by 16 to find both hex digits: 192 ÷ 16 = 12 rem 0 → C0; 168 ÷ 16 = 10 rem 8 → A8; 1 ÷ 16 = 0 rem 1 → 01; 10 ÷ 16 = 0 rem 10 → 0A. Concatenate with 0x prefix.

Hexadecimal result: 0xC0A8010A

Step 4 — Compute the Decimal Integer using the base-256 polynomial: (192 × 16,777,216) + (168 × 65,536) + (1 × 256) + 10 = 3,221,225,472 + 11,010,048 + 256 + 10 = 3,232,235,786.

Decimal Integer result: 3,232,235,786

Practice Questions

The following exercises are representative of the type of questions that appear in Cisco CCNA examinations and undergraduate networking coursework. Attempt each one manually using the methods described above before reading the answer.

Question 1 — IPv4 to Binary

Convert the IPv4 address 172.31.255.254 to its 32-bit dotted binary notation.

Answer: Process each octet independently using the 128-64-32-16-8-4-2-1 rule. Octet 172: 128+32+8+4 = 172 → 10101100. Octet 31: 16+8+4+2+1 = 31 → 00011111. Octet 255: all bits set → 11111111. Octet 254: 128+64+32+16+8+4+2 = 254 → 11111110. Final result: 10101100.00011111.11111111.11111110.

Question 2 — Hexadecimal to IPv4

Convert the hexadecimal value 0x0A1E0164 to dotted-decimal IPv4 notation.

Answer: Strip the 0x prefix to get 0A1E0164. Split into four pairs: 0A, 1E, 01, 64. Convert each pair: 0A → (0 × 16) + 10 = 10; 1E → (1 × 16) + 14 = 30; 01 → (0 × 16) + 1 = 1; 64 → (6 × 16) + 4 = 100. Join with dots: 10.30.1.100.

Question 3 — Decimal Integer to IPv4

Convert the 32-bit unsigned integer 167837953 to its dotted-decimal IPv4 address.

Answer: Apply successive bitwise extraction.

Octet 1 = (167,837,953 >>> 24) & 255 = 167,837,953 ÷ 16,777,216 = 10 (integer part), remainder 16,777, so Octet 1 = 10.

More directly: 167,837,953 mod 256 = 1 (Octet 4), then 167,837,953 ÷ 256 = 655,617 remainder 1; 655,617 mod 256 = 1 (Octet 3), 655,617 ÷ 256 = 2561 remainder 1; 2561 mod 256 = 1 (Octet 2), 2561 ÷ 256 = 10 remainder 1; Octet 1 = 10. Reading the remainders in reverse: 10.1.1.1. Verification: (10 × 16,777,216) + (1 × 65,536) + (1 × 256) + 1 = 167,772,160 + 65,536 + 256 + 1 = 167,837,953 ✓

Frequently Asked Questions

Why is an IPv4 address converted to a 32-bit integer?

An IPv4 address is fundamentally a 32-bit binary number; the familiar dotted-decimal notation (e.g., 192.168.1.1) is merely a human-readable display format that was chosen because four decimal numbers separated by dots are easier for people to read and communicate verbally than 32 consecutive binary digits.

Underneath that display layer, every operating system, router, and network API stores and processes IPv4 addresses as single 32-bit unsigned integers. The conversion to a decimal integer exposes this underlying machine representation.

Practical uses include storing IP addresses in relational database columns as integers (which enables indexed range queries such as "find all addresses within a subnet" far more efficiently than text string comparisons), performing bitwise AND operations with subnet masks to extract the network portion, and interfacing with POSIX socket functions like inet_addr() or htonl() that accept or return the 32-bit integer form. Understanding this conversion is also directly tested in the Cisco CCNA examination.

What happens if an octet value is greater than 255?

An octet value greater than 255 is invalid and makes the entire IPv4 address malformed.

This constraint exists because each octet is defined as exactly 8 binary bits, and the maximum value representable by 8 bits is 28 − 1 = 255.

If any single octet exceeds 255 — for example, if someone types 192.256.1.1 or 10.0.0.300 — the address cannot be accurately encoded into the 8-bit field assigned to that octet without overflowing into the adjacent bits, which would corrupt the neighboring octets and produce an entirely different address.

This tool validates each octet in real time and immediately shows an error indicator when any value falls outside the 0–255 range.

Similarly, any address containing fewer than four octets, non-numeric characters (other than dots in IPv4 mode), or leading zeros within an octet (e.g., 192.168.01.1, which is ambiguous because some parsers interpret a leading zero as octal notation) is also rejected. Valid IPv4 addresses must have exactly four octets, each an integer from 0 to 255 with no leading zeros.

Why does an IPv4 address have exactly four octets and not more or fewer?

The four-octet, 32-bit structure of IPv4 was defined in RFC 791 published in September 1981 and was a deliberate engineering compromise between address space size and implementation simplicity given the hardware capabilities of that era.

Four octets produce a 32-bit address space of 232 = 4,294,967,296 unique values, which the designers of the early ARPANET believed would be more than sufficient for the foreseeable future.

From an encoding perspective, 8 bits per octet is ideal because 8 bits align perfectly with the byte — the fundamental unit of data storage and transmission in virtually all digital hardware since the mid-1970s.

Each octet can be loaded into a single processor register or memory cell, making bitwise operations (masking, shifting, comparing) extremely efficient in hardware and software.

Using fewer octets would have severely limited the address space; using more would have increased the header size of every IP packet and the memory requirements of routing tables at a time when both network bandwidth and router memory were precious resources.

The consequences of the 32-bit address exhaustion ultimately led to the design and gradual deployment of IPv6, which uses 128-bit addresses divided into eight 16-bit groups.

What is the difference between IPv4 Binary and Hexadecimal notation?

Both Binary and Hexadecimal are simply alternative ways of writing the same underlying 32-bit value — they are different numeral systems, not different addresses.

Binary notation uses only the digits 0 and 1 and writes all 32 bits explicitly, grouped into four 8-bit octets separated by dots (e.g., 11000000.10101000.00000001.00000001).

This format is the most pedagogically transparent because it directly shows which individual bits are on or off, making it the preferred representation for understanding subnet masks, bitwise AND operations, and the 128-64-32-16-8-4-2-1 positional weight rule taught in networking courses.

Hexadecimal notation uses the digits 0–9 and letters A–F (base 16) and is more compact: since one hex digit represents exactly 4 bits (one nibble), the entire 32-bit address collapses to just 8 hex characters plus a 0x prefix (e.g., 0xC0A80101).

Hexadecimal is preferred by software developers, packet analysis tools (such as Wireshark), and hardware engineers because it is far shorter than binary while still mapping precisely onto the bit-level structure without any rounding or approximation.

The choice between them depends on context: binary is clearest for teaching and subnet visualisation, while hexadecimal is most compact for display in low-level technical outputs.

Subscribe
Notify of
guest

0 Corrections & Clarifications