BSD Checksum Calculator

Enter text to compute its BSD sum-16 checksum.

How it is calculated

The tool reads the text as bytes (UTF-8 for anything beyond plain ASCII) and keeps a 16-bit running value that starts at 0. For every byte it does two things: rotate the value right by one bit, so the lowest bit moves to the top, s = (s >> 1) + ((s & 1) << 15), and then add the byte and cut the result to 16 bits, s = (s + byte) & 0xFFFF. The final value is shown in decimal and in hexadecimal, together with the byte count. It matches the traditional BSD algorithm of the Unix sum command for the strings tested. Every character counts, including spaces and line breaks, and accented letters or emoji are several bytes. Empty text gives no result. It is a quick legacy check, not protection against tampering.

Worked example

For the text Hello the bytes are 72, 101, 108, 108, 111. Start at 0: rotating changes nothing and adding 72 gives 72. Next, 72 rotated is 36, plus 101 is 137. Then 137 is odd, so its low bit wraps to the top: 68 + 32768 = 32836, plus 108 is 32944. Rotating 32944 gives 16472, plus 108 is 16580. Finally 16580 rotated is 8290, plus 111 gives 8401. The tool shows 8401 (0x20D1) for 5 bytes.

Try this example →

Common mistakes

  • Adding or dropping a space or line break. A trailing newline is one more byte and changes the checksum completely: Hello with a newline at the end gives a different value from Hello.
  • Comparing with a file checksum when the text was typed in a form. A file with Windows line endings has two bytes per break and a typed text may have different breaks, so the byte counts can differ.
  • Ignoring letter case. Hello and hello are different bytes and give different checksums.
  • Expecting the same number as the CRC or other checksum algorithms. BSD sum-16, sum -s (System V), CRC-32 and MD5 are different algorithms with different results.
  • Using it to prove a file was not altered on purpose. It is easy to make two different texts with the same value, so use SHA-256 for integrity against tampering.

About this calculator

The BSD checksum (sum-16) is the classic 16-bit checksum algorithm implemented by the traditional Unix sum command, computed with a simple rotate-and-add loop: for each byte of input, the running checksum is right-rotated by one bit (wrapping the low bit around to the high bit) and then added to that byte’s value, with the whole result kept within 16 bits throughout.

It predates and is much weaker than later checksums like CRC-32 or cryptographic hashes such as MD5 or SHA-256 — collisions are easy to construct and it offers no protection against deliberate tampering — but it remains present as the default algorithm behind the Unix/Linux sum utility for quick, legacy-compatible file integrity spot-checks. This calculator computes the BSD sum-16 of any input text and shows the result in both decimal and hexadecimal.

Was this helpful?

You can pick up to 3 reactions.

Comments

  • Be the first to comment.

Popular calculators

All Calculators