xxHash is one of the fastest hash functions ever published — fast enough to saturate RAM bandwidth on a single CPU thread — which is why it powers LZ4, Zstandard, and countless databases. This calculator computes both the XXH32 and XXH64 variants with an optional seed, entirely in your browser.
How xxHash works: the striped accumulation design
Both variants follow the same structural shape, designed for CPU pipeline efficiency:
Phase 1 — striped accumulation (inputs longer than 16/32 bytes)
xxHash maintains four independent accumulators (v1–v4), each seeded from the input seed combined with constants. For every lane (4 bytes in XXH32, 8 bytes in XXH64), one accumulator absorbs a chunk through a round step:
v = v + (data * prime2)
v = rotateLeft(v, rotationAmount)
v = v * prime1
Processing four accumulators in rotation is what lets xxHash keep four CPU execution units busy simultaneously, achieving near-memory-bandwidth throughput.
Phase 2 — accumulator merging
The four accumulators are folded into a single value using rotates and additions:
h = rotl(v1, 1) + rotl(v2, 7) + rotl(v3, 12) + rotl(v4, 18)
For XXH64 each accumulator is then merged through an additional mixing step before the fold.
Phase 3 — tail bytes and length
Remaining bytes (up to 7 for XXH64, up to 3 for XXH32) are consumed in 8-byte, 4-byte, and 1-byte sub-rounds, and the total input length is added to the accumulator.
Phase 4 — finalisation avalanche
An avalanche sequence of XORs, shifts, and prime multiplications ensures every output bit depends on every input bit:
h = h XOR (h >> shift1)
h = h * prime2
h = h XOR (h >> shift2)
h = h * prime3
h = h XOR (h >> shift3)
XXH32 uses 32-bit lanes and arithmetic; XXH64 uses 64-bit lanes (BigInt in this browser tool for correctness).
xxHash constants
| Constant | XXH32 | XXH64 |
|---|---|---|
| Prime1 | 0x9e3779b1 | 0x9e3779b185ebca87 |
| Prime2 | 0x85ebca77 | 0xc2b2ae3d27d4eb4f |
| Prime3 | 0xc2b2ae3d | 0x165667b19e3779f9 |
| Seed (default) | 0 | 0 |
The constants are chosen from the golden-ratio-derived sequence floor(2^32 * phi) and its relatives — a property that ensures good bit mixing across the word width.
Reference values
| Input | Seed | XXH32 | XXH64 |
|---|---|---|---|
| (empty) | 0 | 0x02cc5d05 | 0xef46db3751d8e999 |
abc | 0 | 0x32d153ff | 0x44bc2cf5ad770999 |
hello | 0 | 0x9738f19b | 0x26c7827d889f6da3 |
hello | 42 | 0xdebc0a95 | (differs from seed 0) |
Use abc with seed 0 to verify the tool matches the reference implementation.
Where xxHash is actually used
- LZ4 and Zstandard — both compression formats use XXH32 or XXH64 to checksum compressed frames.
- ClickHouse and other columnar databases — xxHash is used for sharding and deduplication of column data.
- RocksDB / LevelDB — some configurations use XXH as an alternative to CRC32.
- File synchronisation tools — several rsync-derivative and backup tools prefer xxHash over MD5 for its speed without the baggage of a broken cryptographic algorithm.
- Content-defined chunking — rolling-window chunking algorithms (e.g., FastCDC) use xxHash to fingerprint chunks for deduplication.
Comparison with similar hashes
| Hash | Output | Speed notes |
|---|---|---|
| FNV-1a | 32 or 64 bits | One byte at a time; slower for bulk data |
| MurmurHash3 | 32 or 128 bits | 4-byte lanes; good quality; slower than xxHash |
| xxHash (XXH32/64) | 32 or 64 bits | 16/32-byte lanes; near-RAM-bandwidth speed |
| xxHash3 (XXH3) | 64 or 128 bits | Even faster with SIMD; not computed here |
xxHash is non-cryptographic — never use it where an adversary can engineer collisions. For security-sensitive contexts use SipHash (for keyed MACs) or SHA-256/SHA-3 (for unkeyed integrity). All computation in this tool is local; nothing is uploaded.