FNV-1a (Fowler-Noll-Vo variant 1a) is one of the simplest fast hash functions in wide use, valued for hash tables, bloom filters, and quick content keying. This calculator computes both the 32-bit and 64-bit FNV-1a hashes of your text directly in the browser, with copy buttons for each result.
How FNV-1a works
FNV-1a processes the input one byte at a time with just two operations per byte:
- Initialise the hash to the FNV offset basis —
2166136261(0xcbf29ce4) for 32-bit,14695981039346656037(0xcbf29ce484222325) for 64-bit. - For each byte: XOR the byte into the hash first, then multiply by the FNV prime, keeping the result modulo
2^32or2^64. - The final accumulated value is the hash.
The “a” suffix signals the XOR-before-multiply order. The original FNV-1 multiplied first and XOR’d second — FNV-1a’s swap improves the avalanche behaviour for inputs that differ in only a few bytes.
FNV primes:
- 32-bit:
16777619(0x01000193) - 64-bit:
1099511628211(0x00000100000001b3)
These primes were chosen so that the multiply scatters bits across the full word width before the XOR re-mixes them.
Reference values
| Input | 32-bit FNV-1a | 64-bit FNV-1a |
|---|---|---|
| (empty) | 0x811c9dc5 | 0xcbf29ce484222325 |
hello | 0x4f9f2cab | 0xa430d84680aabd0b |
foobar | 0xbf9cf968 | 0x85944171f73967e8 |
The empty-string value equals the offset basis in both variants because no XOR or multiply is performed. Use hello to verify the tool matches your own implementation.
FNV-1 vs FNV-1a — a concrete example
With the byte 0x41 (ASCII A) and a 32-bit starting state of 0x811c9dc5:
FNV-1 (multiply, then XOR):
hash = (0x811c9dc5 * 16777619) & 0xffffffff = 0x050c5d2f
hash = 0x050c5d2f XOR 0x41 = 0x050c5d6e
FNV-1a (XOR, then multiply):
hash = 0x811c9dc5 XOR 0x41 = 0x811c9d84
hash = (0x811c9d84 * 16777619) & 0xffffffff = 0x4f9f2cab (first byte of "hello")
The swap means an input change immediately participates in the multiply, spreading its influence across more output bits with each subsequent byte.
Where FNV-1a shows up in real systems
- DNS resolvers — several BIND and Unbound versions have used FNV internally for cache keying.
- Programming language runtimes — Rust’s standard library and many scripting language implementations have shipped FNV maps as a default or alternative.
- Bloom filters — FNV-1a’s speed and good distribution make it popular for generating multiple independent hash seeds from a single key (e.g., by using different offset bases or seeding tricks).
- Protocol buffers and serialisation — FNV fingerprints appear in some protobuf-adjacent tooling for field name hashing.
Limitations and security warning
FNV-1a is not cryptographically secure. A determined attacker can construct inputs with deliberate collisions, enabling hash-flooding attacks against hash tables that use FNV-1a without a random seed. If the hash table accepts untrusted keys (for example, from HTTP request headers or query strings), use SipHash or a keyed hash instead. Never use FNV-1a for passwords, tokens, or digital signatures.
The 64-bit variant uses BigInt arithmetic in this tool so that all 64 bits remain accurate; JavaScript’s standard 53-bit number representation would silently lose the high bits otherwise.