Networking

IPv4 Fragment Count & Offset Calculator

Calculate fragment payload size, count and final offset for one IPv4 datagram crossing a smaller MTU.

How the calculation works

Maximum aligned nonfinal fragment payload = floor((mtu-header)/8)*8 bytes. Fragment count = ceil((datagram-header)/(floor((mtu-header)/8)*8)) fragments. Last fragment total length = datagram-header-(ceil((datagram-header)/(floor((mtu-header)/8)*8))-1)*(floor((mtu-header)/8)*8)+header bytes. Last fragment offset in eight-byte units = (ceil((datagram-header)/(floor((mtu-header)/8)*8))-1)*floor((mtu-header)/8) offset units. Total transmitted IP bytes across fragments = datagram-header+ceil((datagram-header)/(floor((mtu-header)/8)*8))*header bytes.

Worked example

Example inputs — Original IPv4 total length (bytes): 4000; Next-hop IP MTU (bytes): 1500; IPv4 header copied into each fragment (bytes): 20. Expected results — Maximum aligned nonfinal fragment payload: 1480 bytes; Fragment count: 3 fragments; Last fragment total length: 1040 bytes; Last fragment offset in eight-byte units: 370 offset units; Total transmitted IP bytes across fragments: 4040 bytes.

Assumptions and limits

Offline planning arithmetic: this calculator sends no packets and changes no device configuration. Actual routing, reservations, implementation limits and measured network conditions must be checked separately. DF is assumed clear and the entered header is copied identically to every fragment. Actual IP options have copy semantics; reassembly loss, tunnels and link-layer bytes are excluded.

Reference and further reading

Read the underlying subject reference. Calculith is an independent implementation; the reference does not endorse or certify this tool.

Related calculators

Browse all 1000 calculators →

Example values are editable. Results are estimates where assumptions apply. Calculations run in your browser. Updated 2026-11-16.