BITCOIN MAINNETLive explorer status
THE MATHS, GENTLY

Hash functions

A hash function turns any data into a short, fixed-size fingerprint, and one changed letter changes it completely. Try it live and see how Bitcoin uses it.

A fingerprint for data

A hash function takes any input (a word, a file, a whole block) and produces a fixed-size output called a hash or digest. Bitcoin mostly uses SHA-256, whose output is always 256 bits, written as 64 hex characters.

Real SHA-256 hashes: one letter of difference gives an unrelated result"hello"inputSHA-2562cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824"hellp"inputSHA-256fdd7585e08c4e2afd71dcabdb4636c89d557a3f42db9e2040c8bbd1708aa4ce7
Real SHA-256 hashes: one letter of difference gives an unrelated result

Four properties that matter

PropertyWhat it meansWhy Bitcoin needs it
DeterministicSame input, same hash, every timeEvery node gets the same result
Fast to computeOne hash takes microsecondsChecking blocks is cheap
One-wayYou can't work backwards from a hashMining has no shortcut
Collision resistantFinding two inputs with the same hash is infeasibleIDs like the txid are unique

Try it

TRY IT · SHA-256 PLAYGROUND
SHA-256 (64 hex characters)

Computed in your browser with the Web Crypto API. Nothing is sent to MyBitcoinExplorer.

Where Bitcoin uses hashes

Everyday uses of hashing

Hashing isn't only for Bitcoin. Websites store hashes of passwords instead of the passwords themselves, and download pages publish file hashes so you can check nothing was tampered with. Bitcoin uses the same idea to make blocks and transactions tamper-evident.

Hash vs checksum vs encryption

HashChecksumEncryption
PurposeFingerprint, tamper evidenceCatch accidental typosKeep data secret
Reversible?NoNoYes, with the key
Resists deliberate attacks?YesNot necessarilyYes
Share this guide
Share on X ↗

Key takeaways

  • A hash function turns any data into a fixed-size fingerprint.
  • A tiny change to the input completely changes the hash.
  • Hashes can't be reversed, which is what makes mining fair.

Common questions

Is hashing the same as encryption?

No. Encryption can be reversed with a key. Hashing is one-way: there's no key to get the input back.

Can two inputs have the same hash?

Mathematically yes, because inputs are unlimited and outputs aren't, but finding such a pair for SHA-256 is considered infeasible.

Why are Bitcoin hashes written in hex?

Hex shows each byte as two characters, so a 32-byte hash fits in 64 readable characters.

Can a hash be decrypted?

No. A hash isn't encrypted data; the original can only be found by guessing inputs.