GuidesNetworking
Networking

How IPv4 Addresses Map Between Decimal, Binary, and Hex

Convert IPv4 octets between dotted decimal, binary, and hexadecimal to understand masks, packet data, and network boundaries.

Dotted decimal IPv4 address aligned with four binary octets and hexadecimal byte pairs An IPv4 address is 32 bits. Dotted-decimal notation simply divides those bits into four 8-bit octets and writes each octet as a decimal number from 0 to 255. Converting the same bytes to binary or hex can make network calculations and packet data much easier to inspect.

One octet is eight bits

Take decimal 192. In binary it is 11000000; in hex it is C0. Doing the same conversion for four octets gives three equivalent representations of one 32-bit address.

Binary reveals subnet boundaries

CIDR prefixes count network bits, so binary is the natural view for understanding where a prefix ends. A /24 boundary occurs after three full octets; /27 extends three more bits into the fourth octet.

Hex is compact for byte-oriented data

Packet captures, memory dumps, and protocol tools often show bytes in hexadecimal. Because each byte is exactly two hex digits, IPv4 addresses map cleanly to four byte pairs.

Leading zeros need care

Binary octets should normally be padded to eight bits for readability, such as 00000101. In dotted decimal, avoid ambiguous legacy forms with leading zeros when configuring systems; use ordinary decimal 5 rather than relying on parser-specific interpretation.

Convert without losing the grouping

Use IPv4 Converter for address-aware conversion. A generic Number Base Converter is useful for learning individual octets, but the IPv4 tool keeps the four-byte structure visible.

Combine with CIDR calculations

After converting an address, use CIDR Calculator to derive the network block for a prefix. The conversion explains the bits; the CIDR calculation applies the boundary rules.

FAQ

Why does each IPv4 octet stop at 255?

Eight bits have 256 possible values, from 0 through 255.

Is the hex form normally used in URLs?

No. Human-facing IPv4 addresses are normally written in dotted decimal. Hex is mostly useful for low-level inspection and conversion.

Practical next step

Use IPv4 Converter when you need to see the same 32 bits in a representation that makes the problem easier to reason about.

A worked four-octet example

For 192.0.2.5, the octets are 192, 0, 2, and 5. In binary they are 11000000.00000000.00000010.00000101; in hexadecimal the bytes are C0 00 02 05. Keeping the dot or byte grouping visible prevents a common mistake: converting the entire decimal-looking address as though it were one base-10 integer.

CODELOPE

Keep experimenting.

Use the free tools alongside the guide when you want to test an idea instead of only reading about it.

Explore free tools →