Adler-32 checksum calculator
Adler-32 is a checksum invented by Mark Adler in 1995 for the zlib compression library (RFC 1950). It is simpler and faster to compute than CRC-32 while still catching most accidental errors. This Adler-32 calculator shows the 32-bit value of any text or file as 8 hex characters.
Example
Input:
The quick brown fox jumps over the lazy dogAdler-32:
5bdc0fdaThe classic textbook example is “Wikipedia”, whose Adler-32 is 11e60398.
How Adler-32 is calculated
- Start with
A = 1andB = 0. - For each byte:
A = (A + byte) mod 65521andB = (B + A) mod 65521. - The checksum is
B × 65536 + A, written as 8 hex digits.
65521 is the largest prime below 2¹⁶. Because A starts at 1, the checksum of empty input is 00000001, not zero.
Strengths and weaknesses
- Fast. Only additions and occasional modulo operations — no tables or polynomial arithmetic.
- Weak for short inputs. With only a few hundred bytes, the sums do not wrap around the modulus, so many values are never used and error detection is noticeably weaker than CRC-32.
- Not cryptographic. Like any checksum, it is easy to forge deliberately. Use a cryptographic hash or HMAC to detect tampering.
Zlib vs gzip trailers
Zlib and gzip compress data with the same DEFLATE algorithm but check it differently: a zlib stream ends with an Adler-32 of the uncompressed data, while a gzip file stores a CRC-32 and the original length. Mark Adler chose the faster Adler-32 for zlib because it is embedded in other formats where speed mattered most.
Where Adler-32 is used
- The 4-byte trailer of every zlib stream, including data inside PNG images and PDF files, checks the uncompressed data.
- rsync’s rolling “weak” checksum is an Adler-32-style sum that can be updated in constant time as a window slides through a file.
- Quick integrity checks in games, embedded systems and network protocols where speed is key.
In code: Python zlib.adler32(data), Java java.util.zip.Adler32, PHP hash('adler32', $s). To create a zlib stream and see its Adler-32 trailer, try Zlib Compress; for stronger error detection, use CRC-32. The calculation runs in your browser.
Computing Adler-32 in code
Most standard libraries already include Adler-32, so you rarely need to write the loop yourself. Each of these prints 11e60398 for the text “Wikipedia”:
# Python
import zlib
print(format(zlib.adler32(b"Wikipedia"), "08x"))
// PHP
echo hash('adler32', 'Wikipedia');
// Java
Adler32 a = new Adler32();
a.update("Wikipedia".getBytes(StandardCharsets.UTF_8));
System.out.printf("%08x%n", a.getValue());
// Go
fmt.Printf("%08x\n", adler32.Checksum([]byte("Wikipedia")))Why your value might not match
- A trailing newline.
echo "Wikipedia"adds\n, which changes the result to158803a2. Useprintfor paste the text without a final line break. - A different text encoding. The same word encoded as UTF-16 gives
23cc0398. This tool hashes UTF-8 bytes. - Signed integers. Some languages print the checksum as a negative number; format it as unsigned hex before comparing.