Checksum Calculator: Byte Sum, XOR, Fletcher, Adler-32 and Internet Checksum

This checksum calculator computes the common simple checksums of any text or hex bytes in one go: the 8-bit byte sum, two’s complement checksum, XOR (LRC), Fletcher-16, Fletcher-32, Adler-32 and the Internet checksum from RFC 1071. Paste your data, choose text or hex, and read every result at once.

Computing & Networking Tools Calculators

Checksum Calculator

Byte-sum, two’s complement, XOR, Fletcher-16/32, Adler-32 and the Internet (RFC 1071) checksum of any text or hex bytes in one go.

Plain text (UTF-8) or hex bytes such as 00 01 F2 03.
Fletcher-32 reads 16-bit little-endian words and pads an odd final byte with zero. The Internet checksum reads big-endian 16-bit words. None of these are cryptographic hashes.

Starting values: the calculator opens with the text Wikipedia. The Adler-32 is 11E60398, the Fletcher-16 is EE9A, the XOR is 45 and the 8-bit sum is 97, all in hex.

What each checksum does

  • 8-bit sum: add all bytes and keep the low 8 bits.
  • Two’s complement checksum: the negative of the 8-bit sum, so that adding the checksum to the sum of the data gives zero.
  • XOR (LRC): exclusive-or of every byte, a longitudinal redundancy check.
  • Fletcher-16 and Fletcher-32: two running sums, one of the data and one of the first sum, which catches changes in byte order that a plain sum misses.
  • Adler-32: a Fletcher-style checksum using the prime 65521, used in zlib.
  • Internet checksum: the one’s complement of the one’s complement sum of 16-bit words, used in IP, TCP and UDP headers.

None of these are cryptographic hashes. They catch accidental errors, not deliberate changes.

The formulas

Adler-32: A = 1 + the sum of all bytes, B = the sum of every running value of A, both modulo 65521. The result is B × 65536 + A.

Fletcher-16: A = the running sum of the bytes modulo 255, B = the running sum of A modulo 255. The result is B × 256 + A.

Internet checksum: add the data as 16-bit big-endian words, fold any carry out of the top 16 bits back into the bottom, then take the bitwise complement. The calculator pads an odd final byte with zero. Fletcher-32 reads 16-bit little-endian words and also pads an odd final byte with zero.

Worked examples

Example 1: the default text

Wikipedia has 9 bytes whose values add up to 919. In hex that is 397, so the 8-bit sum is 97, and the two’s complement checksum is 69 because 97 + 69 = 100 (hex). The XOR of the bytes is 45. For Adler-32, A = 1 + 919 = 920 (hex 0398) and B works out to 4,582 (hex 11E6), so the Adler-32 is 11E60398. The calculator also shows Fletcher-16 as EE9A, Fletcher-32 as B7DDA1F8 and the Internet checksum as 075E.

Example 2: Fletcher on the text abcde

Fletcher-16 of abcde is C8F0 and Fletcher-32 is F04FC729. These match the values commonly given as test vectors, so they are useful to confirm that a calculator is using the same convention.

Example 3: the RFC 1071 example

RFC 1071 works through four 16-bit words: 0001, F203, F4F5 and F6F7. Their sum is 2DDF0, folding the carry gives DDF2, and the complement is 220D. To reproduce it, set Input is to Hex bytes and enter 00 01 F2 03 F4 F5 F6 F7. The Internet checksum should read 220D.

Choosing a checksum

A plain byte sum is the weakest: it cannot tell AB from BA. The Fletcher checksums and Adler-32 are position-aware, so swapping two bytes changes the result. The Internet checksum is a protocol standard, so use it only where a protocol asks for it. For stronger detection of burst errors, a CRC is the usual choice, and you can compute one with the CRC32 calculator.

Tips

  • Text is read as UTF-8, so accented letters count as two or more bytes.
  • A trailing newline is an extra byte and changes every result.
  • If your value differs from a device\’s, check byte order and padding first.

Example 4: catching a swapped byte

Enter the text AB and then BA. The 8-bit sum is 83 in hex both times, because addition does not care about order, and the XOR is 03 both times for the same reason. Fletcher-16 and Adler-32 give different values for the two inputs, because their second running sum weights each byte by its position. This is the practical reason to prefer them over a plain sum when the order of the data matters.

Example 5: verifying a message with a two’s complement checksum

Take the bytes 01 02 03. Their 8-bit sum is 06 and the two’s complement checksum is FA. Append FA to the message and add all four bytes: 06 + FA = 100, which keeps as 00 in 8 bits. A receiver that gets a total of 00 knows the message passed the check. If any single byte changes, the total is no longer 00.

Limits of simple checksums

A checksum has a fixed size, so many different inputs share the same value. An 8-bit checksum has only 256 possible values, which means a random corruption has about a 1 in 256 chance of going unnoticed. The 16-bit and 32-bit checksums lower that chance, but they are still weaker than a CRC for burst errors, and none of them resist a deliberate change. Short inputs also behave badly with Adler-32, since its sums stay small and the high bits barely change.

Frequently asked questions

What is the difference between a checksum and a CRC?

Both detect accidental errors. A simple checksum adds up the data, while a CRC divides it by a polynomial, which catches many more kinds of error, including burst errors.

What is the Adler-32 of Wikipedia?

11E60398 in hex. It is the standard example for Adler-32.

How is the Internet checksum calculated?

Add the data as 16-bit words, fold any carry back into the sum, and take the complement. RFC 1071 describes it.

Can I use a checksum to verify a download?

A checksum catches accidental corruption, but it is not safe against deliberate tampering. Use a cryptographic hash for that.

Why do I get different results for the same text?

Check the text encoding, trailing newlines and byte order. The calculator reads text as UTF-8.

Mark Danny

Mark Danny

Mark Danny builds and maintains the free calculators and guides on Area of Irregular Shapes Calculator. Every calculator page explains its formula and shows a worked example, so you can check the working yourself. Spotted a mistake or have a suggestion? Email gulsher.hingoro101@gmail.com.

Articles: 754