Hamming Weight Calculator

Enter a number and select its base.

How to use

  1. Enter your values in the fields above.
  2. Press Calculate to see your result instantly.
  3. Use the Share button to copy a link to your result.

About this calculator

The Hamming weight of a number — also called its population count or popcount — is simply the count of 1-bits in its binary representation. For example, the decimal number 13 is 1101 in binary, giving it a Hamming weight of 3. This calculator accepts a number in decimal, hexadecimal, or binary and counts its set bits directly.

Popcount is a workhorse operation in computer science and digital electronics: it measures the “distance” between two binary codes in error-detecting and error-correcting codes (the Hamming distance between two values is the popcount of their XOR), it underlies bit-manipulation tricks in cryptography and hashing, and it appears in digital signal processing and chess-engine bitboards, where CPUs even provide a dedicated POPCNT instruction because the operation is so common.

Was this helpful?

Comments (0)

  • Be the first to comment.

Popular calculators

All Calculators