Xerobit

FNV Hash Generator: FNV-1 and FNV-1a (32/64-bit)

Enter text or hex bytes to compute its FNV hash: FNV-1 or FNV-1a, 32-bit or 64-bit. The Fowler-Noll-Vo function is a fast non-cryptographic hash used in hash tables. Results show in hex and decimal and run in your browser.

Text is hashed as UTF-8 bytes. Choose Hex bytes to hash raw bytes.

Result

  • Hash (hex)
    4f9f2cab
  • Hash (decimal)
    1335831723
  • Variant
    FNV-1a (32-bit)
  • Input length
    5

    bytes

How to use the fnv hash generator

  1. Type or paste your data into the Input field. Pick Hex bytes if you want to hash raw bytes instead of text.
  2. Select the variant: FNV-1 or FNV-1a, in 32-bit or 64-bit.
  3. The fnv hash updates as you type, shown as lowercase hexadecimal (zero padded to the full width) and as a decimal number.

How the FNV algorithm works

The Fowler-Noll-Vo hash function walks over the input one byte at a time. It starts from an offset basis and, for each byte, multiplies by a fixed prime and XORs in the byte. The only difference between the two variants is the order of those two steps.

FNV-1 does hash = (hash * prime) XOR byte, and FNV-1a does hash = (hash XOR byte) * prime. All arithmetic wraps at the hash width. For 32 bits the offset basis is 0x811c9dc5 and the prime is 0x01000193.

Worked example for the single character "a" (byte 0x61) with FNV-1 32-bit:

  1. Start with the basis: 0x811c9dc5
  2. Multiply by the prime and keep the low 32 bits: 0x811c9dc5 * 0x01000193 = 0x050c5d1f
  3. XOR with 0x61: 0x050c5d1f ^ 0x61 = 0x050c5d7e

The FNV-1 result for "a" is therefore 050c5d7e. FNV-1a runs the same steps in the other order, XORing 0x61 into the basis first, and gives e40c292c.

Constants reference table

Each width uses one offset basis and one prime, shared by FNV-1 and FNV-1a. These constants come from the FNV specification, and changing either gives a different, non-standard hash.

WidthOffset basisPrime
32-bit0x811c9dc50x01000193
64-bit0xcbf29ce4842223250x00000100000001b3

Use these published results to check any implementation:

InputFNV-1 32FNV-1a 32FNV-1a 64
(empty)811c9dc5811c9dc5cbf29ce484222325
"a"050c5d7ee40c292caf63dc4c8601ec8c
"foobar"31f0b262bf9cf96885944171f73967e8

FNV-1 versus FNV-1a

The original FNV-1 multiplies the running hash by the prime before XORing the next byte. FNV-1a XORs the byte first and then multiplies. Because the multiplication happens after the last byte is mixed in, FNV-1a spreads the effect of the final byte across more bits, and it is the variant the FNV authors recommend for new work.

Both variants use the same offset basis and prime for a given width, and they give the same result for an empty input. For single-byte inputs they differ, as the table above shows for "a".

Common use cases for FNV hashes

Because the fnv hash is very fast and tiny to implement, it shows up where cryptographic strength is not needed:

  • Hash tables: mapping short string keys to buckets. Go ships FNV in its standard library.
  • Fingerprints and cache keys: a quick 32-bit or 64-bit label for a string or a small block of data.
  • Bloom filters and sharding: FNV can supply one of several hash functions, or decide which shard a key belongs to.

If you have an unknown digest and want to know what produced it, a hash identifier can narrow it down by length and format, though FNV outputs of 8 or 16 hex digits fit many functions.

Limitations and edge cases

FNV is a non-cryptographic hash. Collisions are easy to construct on purpose, so never use it for passwords, signatures or message authentication. For those tasks use a tool such as the SHA-256 hash generator or the HMAC SHA256 generator.

Text is encoded as UTF-8 before hashing, so an accented letter is two bytes and an emoji is four, and each byte is hashed separately. Other encodings such as UTF-16 will give different results; enter those bytes as hex instead. An empty input returns the offset basis, because no byte changes it.

What this tool does not do: it covers only the 32-bit and 64-bit sizes (not FNV-0 or the 128-bit to 1024-bit versions) and it hashes pasted text or hex, not files.

Worked examples

ExampleInputResult
Empty string (FNV-1a 32-bit)Input format: text; Variant: fnv1a-32Hash (hex): 811c9dc5; Hash (decimal): 2166136261; Variant: FNV-1a (32-bit); Input length: 0
"hello" (FNV-1a 64-bit)Input: hello; Input format: text; Variant: fnv1a-64Hash (hex): a430d84680aabd0b; Hash (decimal): 11831194018420276491; Variant: FNV-1a (64-bit); Input length: 5
"a" (FNV-1 32-bit)Input: a; Input format: text; Variant: fnv1-32Hash (hex): 050c5d7e; Hash (decimal): 84696446; Variant: FNV-1 (32-bit); Input length: 1
Raw bytes as hexInput: 00 ff 10; Input format: hex; Variant: fnv1a-32Hash (hex): 028f5a10; Hash (decimal): 42949136; Variant: FNV-1a (32-bit); Input length: 3

FAQ

What is an fnv hash?

An fnv hash is a digest produced by the Fowler-Noll-Vo algorithm, a fast non-cryptographic hash function. It comes in 32-bit and 64-bit sizes and two variants: FNV-1 and FNV-1a.

Is FNV suitable for passwords?

No. FNV is designed for speed, not security. Collisions can be generated intentionally with minimal effort. Use bcrypt, scrypt or Argon2 for password hashing instead.

Why does an empty string return a non-zero hash?

The algorithm initializes the hash state with an offset basis constant (for example, 0x811c9dc5 for 32-bit). Since no bytes are processed for an empty string, the output is simply that basis value.

What is the difference between FNV-1 and FNV-1a?

FNV-1 multiplies then XORs each byte, while FNV-1a XORs then multiplies. FNV-1a mixes the last byte better and is generally preferred.

Does this tool upload my data?

No. The fnv hash computation runs entirely in your browser using JavaScript. Your input text never leaves your device.

Can I hash binary files with this tool?

You can hash raw bytes by switching the input format to Hex bytes and entering them as hex, for example 00 ff 10. The tool does not read files, so a file has to be pasted in as hex first.