An IPv4 address converts to an 8-digit hexadecimal value through a single base-256 sum: each of the four octets is a byte, the first octet occupies the most significant 8 bits, and the integer 0 through 4294967295 you get along the way is the exact decimal form of the same address.

Converting an IP address to hexadecimal is straightforward once you treat the dotted-decimal notation as four packed bytes. Each octet ranges from 0 to 255 and maps to exactly two hexadecimal digits (00 through FF), so 192.168.1.1 becomes C0A80101 and 127.0.0.1 becomes 7F000001. The cleanest path to the hex form is to convert the IPv4 to its unsigned 32-bit integer first using base-256 arithmetic, then render that integer as eight hex digits. The base-256 formula a×256³ + b×256² + c×256 + d gives a single decimal value that fully describes the address, and dividing that value back into four base-256 components recovers the original octets. The IP to Decimal Converter performs this arithmetic exactly within JavaScript's safe integer range, with no rounding, no DNS lookup, and no ambiguity from leading zeros. The hex rendering that follows is a textbook exercise in positional notation that you can do on paper or in any language with a hex-format specifier.

how to convert decimal ip address to hexadecimal
How to Convert a Decimal IP Address to Hexadecimal

What the Decimal and Hexadecimal Forms Represent

According to RFC 791, an IPv4 address is a 32-bit label written in dotted-decimal for human reading. The same 32 bits can be expressed in any positional base. In base 10 (decimal) you get an integer from 0 through 4294967295. In base 16 (hexadecimal) you get up to eight digits because each hex digit covers four bits and four bits times eight equals 32 bits. The mapping between the two views is exact: no bits are lost, reordered, or rounded, because both representations are just different renderings of the same 32-bit pattern.

The decimal form is convenient for arithmetic and for storage in columns that need to sort numerically. The hexadecimal form is convenient for code, packet captures, configuration snippets, and anywhere a 32-bit field needs to be read at a glance without splitting on periods. Both forms describe the same address with no extra network meaning attached. Private, loopback, multicast, documentation, reserved, and public addresses all convert with the same arithmetic, so the resulting decimal or hex value is not, by itself, evidence that an address is routable, safe, or appropriate for any access-control rule.

Octet positionMultiplierDecimal value
1 (a)256³16,777,216
2 (b)256²65,536
3 (c)256¹256
4 (d)256⁰1

How to Convert an IPv4 Address to Hexadecimal

The path from a dotted-decimal address to a hexadecimal string has two stages. The first stage uses the converter to produce the exact decimal integer. The second stage is a short hex-format step you can finish by hand or in code.

  1. Open the IP to Decimal Converter and choose the IPv4 to decimal direction so the field accepts a dotted-decimal address.
  2. Type the strict address with four decimal octets separated by periods, no surrounding spaces, no /CIDR suffix, and no leading zeros (so 192.168.1.1, not 192.168.001.1).
  3. Convert and read the displayed integer. Confirm it is an unsigned value that fits within 0 through 4294967295.
  4. Copy the decimal result and render each octet as two hexadecimal digits, padding with a leading 0 where needed (for example, 192 → C0, 1 → 01), then concatenate the four pairs into one 8-character string.
  5. Paste the hex value into the destination column or field and confirm it is stored as an unsigned 32-bit value, a wider integer, or a validated string so no signed-overflow happens later.

If you already have a decimal integer and want the hex form, choose the decimal to IPv4 direction in the converter, paste the integer, read the four-octet result, and convert each octet to two hex digits. The decimal form is the bridge between the dotted-decimal text and the hex digits because both are exact, lossless renderings of the same 32-bit pattern.

A Worked Example: 192.168.1.1 in All Three Forms

Take the address 192.168.1.1. Using the base-256 formula and the multipliers from the table above, the decimal value is computed as 192 × 16,777,216 + 168 × 65,536 + 1 × 256 + 1 × 1. The first product is 3,221,225,472; the second is 11,010,048; the third is 256; the fourth is 1. Adding them gives 3,221,225,472 + 11,010,048 + 256 + 1 = 3,232,235,777.

To get the hexadecimal form, convert each octet independently. 192 in base 16 is C0 (12 × 16 + 0), 168 is A8 (10 × 16 + 8), 1 is 01, and 1 is 01. Concatenate the four pairs in the same order as the octets and you get C0A80101. The same eight digits appear if you convert the full integer 3232235777 to hex, because both routes describe the same 32 bits. The round-trip back to dotted-decimal goes by splitting C0A80101 into C0, A8, 01, 01, then translating each pair to decimal.

Dotted-decimalDecimal (0–4,294,967,295)Hexadecimal
0.0.0.0000000000
10.0.0.1167,772,1610A000001
127.0.0.12,130,706,4337F000001
192.168.1.13,232,235,777C0A80101
255.255.255.2554,294,967,295FFFFFFFF

Why Strict Input Rules Matter for Decimal Conversion

The decimal form is only as trustworthy as the input that produced it. The converter parses exactly four unpadded decimal octets and rejects anything ambiguous. Leading zeros such as 010.0.0.1 are refused because legacy software has interpreted them as octal, which would silently turn the value 10 into the value 8 once the prefix is treated as a base marker. Surrounding whitespace, plus or minus signs, CIDR suffixes, omitted octets, and hexadecimal notation are all rejected for the same reason: an exact integer cannot be produced from a string whose meaning depends on the parser.

Each parsed octet must fall in the inclusive range 0 through 255. Decimal form must contain digits only, must not have leading zeros except for the literal value 0, and must stay within the full unsigned 32-bit range. These constraints are what guarantee that the integer the tool returns maps unambiguously to one address, and that the hex rendering you build from it has the same single-address interpretation. Strict input is what keeps the round-trip IPv4 → decimal → hex → IPv4 equal to the original value.

Storing and Sorting Addresses as Numbers

Numeric storage is useful for sorting, range scans, and arithmetic across an address column. A decimal column that sorts numerically produces network order (0.0.0.0, 0.0.0.1, …, 255.255.255.255), whereas a text column that contains dotted-decimal strings does not sort in network order because lexicographic comparison breaks at every period. Hexadecimal storage has the same property once normalized to a fixed-width 8-character string, and it is sometimes preferred in log pipelines or low-level tooling because the 8-digit form maps directly to the 32-bit field width.

Two pitfalls appear when moving between representations. First, environments that expose only signed 32-bit integers will display values above 2,147,483,647 as negative numbers, and the same number rendered as hex would still show 8 digits but with the high bit set. Pick an unsigned 32-bit type, a wider integer, or a string column that preserves the digits. Second, hexadecimal can be rendered in mixed case and with or without a 0x prefix. Pick one convention and apply it consistently so log searches, regexes, and copy-paste workflows do not silently miss matches.

When Hexadecimal Helps, and Where the Tool Stops

Hexadecimal addresses show up in binary protocol fields, in tcpdump-style packet captures, in some firewall exports, and in code that reads or writes raw 32-bit values. Converting a single address by hand is fine; converting thousands calls for automation, and the IP to Decimal Converter produces the exact intermediate integer that a one-line hex-format step can then render. The tool handles individual IPv4 addresses only. CIDR prefixes, subnet masks, port numbers, hostnames, IPv6, and arbitrary-size integers are out of scope; a suffix such as /24 is rejected rather than silently dropped, and you should reach for a Subnet Calculator when you need network and broadcast boundaries or host counts.

No network call is made while you convert. The arithmetic runs in the browser, the value is not logged or stored by the tool, and the result you copy is the only artifact. If classification matters (private versus public, assigned versus reserved, routable versus not), apply current address registries and network policy separately, because the decimal and hex forms carry no extra meaning beyond the 32-bit value itself.

If you're weighing options, Change IPv4 to IPv6 on Xbox: Mapped Address Guide covers this in detail.

If you're weighing options, How to Find the IPv6 Prefix of an Address covers this in detail.