IPv4 · Local calculator

IPv4 Decimal Converter

Some inventories encode an IPv4 address in one unsigned integer column. Use the decimal converter to translate between that representation and dotted notation without losing the original octet order.

Inputs

Result

Decimal
3221225997
Dotted IPv4
192.0.2.13

Octets are ordered from most significant to least significant.

In this guide12 sections

Introduction

Some inventories encode an IPv4 address in one unsigned integer column. Use the decimal converter to translate between that representation and dotted notation without losing the original octet order.

Formula and calculation

IPv4 dotted value to decimal
value = octet1×256^3 + octet2×256^2 + octet3×256 + octet4

The unsigned decimal integer preserves the four octets' network order. It ranges from 0 through 2^32−1.

octet · byte
one decimal address component from 0 through 255

Method and concepts

Treat the four octets a, b, c and d as digits in base 256. Their combined value is a × 256³ + b × 256² + c × 256 + d. Each term shifts its octet into the correct position. The result ranges from zero to 2³² − 1 inclusive.

  1. Enter a dotted IPv4 address or its complete unsigned integer representation in the appropriate input format.
  2. For a forward check, multiply the running total by 256 before adding each next octet. For a reverse check, divide by 256 repeatedly and read the remainders in reverse order.
  3. Record the integer together with its encoding. Other software can store signed integers or raw bytes in a different order.

IPv4 addresses and packet headers diagram

  1. IP packet · 1,500 bytes
  2. IPv4 header · 20 bytes
  3. IP payload · 1,480 bytes
  4. TCP data · 1,460 bytes
Read the sizes as a decomposition. After removing a 20-byte IPv4 header, a further 20-byte TCP header leaves 1,460 bytes for TCP data.

Worked examples

Recover a dotted address from the integer 3,221,225,985

  1. Divide by 256. The quotient is 12,582,914 and the remainder is 1. This remainder is the final octet.
  2. Divide the quotient again. Its quotient is 49,152 and remainder 2. The next division gives quotient 192 and remainder 0.
  3. Read the four octets from most to least significant as 192.0.2.1. Check with 192 × 16,777,216 + 0 × 65,536 + 2 × 256 + 1 = 3,221,225,985.

IPv4 addresses and packet headers: Read the first IPv4 byte 0x45

  1. Split 0x45 into the high hex digit 4 and low digit 5. The upper four bits identify version 4. The lower four encode an IHL of five words.
  2. Multiply 5 by 4 bytes to obtain the 20-byte header. With Total Length 1,500, the IP payload contains 1,480 bytes.
  3. If Protocol is 6 and the TCP header also occupies 20 bytes, the segment carries 1,460 application bytes. Adding IPv4 or TCP options reduces that amount at the same packet size.

Reference table

IPv4 Decimal Converter reference
Octet positionMultiplierContribution for 192.0.2.1
First16,777,2163,221,225,472
Second65,5360
Third256512
Fourth11

Reading the result

An unsigned representation gives positive values even when the high bit is set. Arithmetic on consecutive integer values carries across octet boundaries automatically, making this form convenient for sorting or counting intervals.

Common mistakes

  • Concatenating the octet strings, which discards their base-256 place values.
  • Discarding intermediate zero octets when reversing by division.

Frequently asked questions

What is the largest valid IPv4 integer?

4,294,967,295 corresponds to 255.255.255.255. The next integer would require a thirty-third bit.

How do I interpret a negative value from an older database?

Check the column's specification first. If it stores a signed 32-bit two's-complement encoding, adding 4,294,967,296 to a negative stored value recovers the unsigned integer.

What does /32 mean on a route?

All 32 address bits must match. The route represents exactly one IPv4 value and can identify a loopback or another specific destination.

Is the IPv4 Protocol number the service port?

No. The protocol number selects a payload format, for example UDP 17. A UDP header then carries source and destination port numbers.

How many bytes are in the minimum IPv4 header?

The minimum header is 20 bytes. The IHL field counts 32-bit words, so a value of five represents 20 bytes; options can make it longer.

Does IPv4 Total Length include Ethernet framing?

No. It counts the IPv4 header and IPv4 payload. Link-layer framing is outside that length field.

What happens when an IPv4 packet is larger than an outgoing MTU?

Depending on the Don't Fragment setting and path behavior, it may be fragmented or dropped with an ICMP message. Path MTU discovery uses this feedback to find a usable packet size.

Does an IPv4 Protocol number identify a TCP or UDP port?

No. The Protocol field identifies the payload protocol, such as TCP or UDP. A TCP or UDP header then contains the service ports.

What does TTL protect against?

IPv4 Time To Live bounds how many forwarding hops a packet can survive. Routers decrement it so a packet cannot circulate forever in a forwarding loop.

Is the IPv4 header checksum an end-to-end payload checksum?

No. It covers the IPv4 header only and is recomputed when mutable header fields such as TTL change. Transport protocols have separate integrity fields.

Can IPv4 fragmentation be reassembled at every router?

No. Fragmentation can occur during forwarding when permitted, but fragments are normally reassembled by the destination host, not each intermediate router.

Why use documentation IPv4 ranges in examples?

The designated documentation blocks avoid using a real organization's address in examples. They should not be treated as ordinary public service addresses.

What is the difference between limited broadcast and directed broadcast?

The limited broadcast address is 255.255.255.255 and is confined to the local link. A directed broadcast targets the all-ones host part of a particular IPv4 subnet and is commonly filtered by routers.

Can two routers advertise the same IPv4 prefix?

They can provide alternative routes to the same prefix. Routing policy and metrics determine whether one is preferred or both are installed for load sharing.

Why is classful addressing considered historical?

The original A, B, and C boundaries fixed network sizes at coarse octet edges. CIDR allows a prefix boundary at any bit and is used for modern allocation and routing.

What is the IPv4 header checksum recalculated over?

It covers the IPv4 header, not the payload. Because forwarding changes TTL, a router updates the checksum as the packet traverses the path.

When can a /31 IPv4 prefix be useful?

On a point-to-point link, RFC 3021 allows both addresses to be assigned to the two endpoints. It avoids reserving separate network and broadcast values where those functions are not needed.

Further learning and references