Internet Protocol Checksum Calculator
Use this Internet Protocol Checksum Calculator to calculate the standard 16-bit one’s-complement checksum used by IPv4, TCP, UDP, and other Internet protocol data. Enter hexadecimal bytes to see the checksum, one’s-complement sum, word count, padding, and verification value.
-
-
What Is an Internet Protocol Checksum?
The Internet checksum is a 16-bit error-detection value used by several Internet protocols. It is based on one’s-complement addition rather than a polynomial CRC.
RFC 1071 defines the Internet checksum by grouping adjacent octets into 16-bit integers, adding those words using one’s-complement arithmetic, and taking the one’s complement of the resulting 16-bit sum when generating the checksum. :contentReference[oaicite:1]{index=1}
The same checksum family is used by IPv4 header checksums and in TCP and UDP checksum calculations, although TCP and UDP also include protocol-specific pseudo-header data in their complete checksum coverage.
How to Use the Internet Checksum Calculator
Choose Generate Checksum when creating a new checksum, or Verify Existing Checksum when the supplied data already contains the checksum value.
Use Hexadecimal Bytes for packet captures or 16-Bit Hex Words when you already have grouped protocol words.
For a new IPv4 header checksum, place 0000 in the header checksum field before calculating.
The tool groups bytes into 16-bit words and repeatedly folds end-around carry bits back into the low 16 bits.
Generation mode complements the final sum to produce the transmitted checksum.
How the Internet Checksum Is Calculated
Adjacent bytes are interpreted as 16-bit words in network order. Those words are added using one’s-complement arithmetic. Any carry above bit 15 is added back into the low 16-bit result.
RFC 1071 gives the intermediate one’s-complement sum of this example as 0xDDF2. Complementing that value gives checksum 0x220D. :contentReference[oaicite:2]{index=2}
IPv4 Header Checksum Calculation
IPv4 includes a 16-bit Header Checksum field. RFC 791 specifies that this checksum covers the IPv4 header only, not the payload. Before calculating a new checksum, the checksum field itself is treated as zero. :contentReference[oaicite:3]{index=3}
Because fields such as Time To Live can change while a packet is forwarded, the IPv4 header checksum must be updated when relevant header data changes. RFC 791 explicitly notes that the header checksum is recomputed and verified as the header is processed. :contentReference[oaicite:4]{index=4}
Generate Checksum vs Verify Checksum
Generate Mode
Add all applicable 16-bit words using one’s-complement arithmetic, then invert all 16 bits of the final sum.
Verify Mode
Include the transmitted checksum in the data. A correct complete one’s-complement sum produces 0xFFFF.
RFC 1071 describes checksum verification by summing the same set of octets including the checksum field. A valid result is all one bits in one’s-complement arithmetic. :contentReference[oaicite:5]{index=5}
Why Is End-Around Carry Required?
Ordinary binary addition discards a carry that exceeds the chosen word size. One’s-complement addition instead wraps that carry around and adds it back to the low-order bits.
This end-around carry behavior is fundamental to the Internet checksum and distinguishes it from ordinary unsigned addition.
What Happens with an Odd Number of Bytes?
The checksum operates on 16-bit words, so an odd number of input octets leaves one final unmatched byte.
For calculation purposes, that last byte is paired with a zero byte to form the final 16-bit word. The calculator reports when this zero padding was required.
Internet Checksum vs CRC
The Internet checksum is not a cyclic redundancy check. CRC algorithms use polynomial division, while the Internet checksum uses one’s-complement addition of 16-bit words.
The two mechanisms therefore have different mathematical properties and must not be substituted for each other simply because both are used for error detection.
IPv4 Checksum vs TCP and UDP Checksums
| Protocol | Checksum Coverage | Important Detail |
|---|---|---|
| IPv4 | IPv4 header only | The IPv4 checksum field is zeroed during generation. |
| TCP | Pseudo-header + TCP header + TCP data | The pseudo-header contributes IP addressing and protocol information. |
| UDP | Pseudo-header + UDP header + UDP data | Full checksum calculation requires the protocol pseudo-header. |
| Raw data | User-supplied bytes | The same 16-bit one’s-complement arithmetic can be calculated directly. |
RFC 1071 specifically discusses the Internet checksum as used by IP, UDP, and TCP. :contentReference[oaicite:6]{index=6}
Why TCP and UDP Need a Pseudo-Header
A TCP or UDP checksum is not calculated over the transport segment alone. Protocol checksum construction also incorporates selected network-layer information through a pseudo-header.
That means simply pasting a TCP or UDP header into a generic Internet checksum calculator does not produce the complete wire checksum unless the required pseudo-header and payload bytes have also been included.
Internet Checksum Worked Example
This matches the numerical example described in RFC 1071. :contentReference[oaicite:7]{index=7}
Common Internet Checksum Mistakes
Using Ordinary Addition
Carries must be wrapped around into the lower 16 bits rather than discarded.
Wrong Byte Pairing
Adjacent bytes must be grouped consistently into 16-bit words.
Not Clearing the IPv4 Field
When generating an IPv4 header checksum, the checksum field must be zero during the calculation.
Forgetting Odd-Byte Padding
A final unpaired byte requires a zero byte for checksum arithmetic.
Omitting the TCP/UDP Pseudo-Header
A complete TCP or UDP checksum needs more than just the transport header.
Confusing Checksum with CRC
The Internet checksum uses one’s-complement arithmetic, not polynomial CRC division.
Internet Protocol Checksum Calculator FAQs
What is the Internet checksum?
Which protocols use the Internet checksum?
How is the IPv4 header checksum calculated?
Does the IPv4 checksum include payload data?
What is one’s-complement addition?
What does a valid checksum verify to?
What if the data has an odd number of bytes?
Is the Internet checksum the same as CRC-16?
Does TCP use the same checksum algorithm?
Does UDP use the same checksum algorithm?
Why must the IPv4 checksum be recalculated?
Can I enter spaced hexadecimal bytes?
Can I enter 16-bit words directly?
What is the checksum of 0001 F203 F4F5 F6F7?
Does this calculator require PHP processing?
Calculate Internet Checksums Instantly
Enter IPv4 header bytes, TCP/UDP checksum data, or arbitrary hexadecimal protocol words to calculate the standard 16-bit one’s-complement checksum, inspect the intermediate sum, and verify existing checksum values.