BITCOIN MAINNETLive explorer status
THE MATHS, GENTLY

SHA-256

SHA-256 is the hash function Bitcoin uses for blocks, transaction IDs and mining, usually applied twice. Learn how it works and test it live.

The basics

SHA-256 (Secure Hash Algorithm, 256-bit) was designed by the US National Security Agency and published by NIST in 2001. It's one of the most studied hash functions in the world, and used far beyond Bitcoin.

  • Output: 256 bits = 32 bytes = 64 hex characters.
  • Works on 64-byte chunks, mixing them through 64 rounds of bit operations.

Double SHA-256

Bitcoin usually hashes twice, called HASH256:

Bitcoin's double hashDataSHA-256SHA-256HASH25632 bytes
Bitcoin's double hash

Used for: block hashes, txids, merkle trees and Base58Check encoding checksums. A widely cited reason is protection against "length extension" weaknesses that affect single SHA-256 in some designs.

See it work

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

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

EXAMPLE

Verify a known hash

The SHA-256 of the text abc is always ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad. Type abc above and check.

How big is 2^256?

SHA-256 has 2^256 possible outputs, a number with 78 digits. If every computer on Earth tried a trillion inputs per second for billions of years, the chance of finding a match for one chosen hash would still be negligible. That's the gap Bitcoin's security relies on.

Where SHA-256 runs in Bitcoin

UseApplied
Mining and block IDsTwice, on the 80-byte header
Transaction IDsTwice, on the transaction without witness
Merkle treesTwice, on each pair of hashes
Address checksumsTwice, first 4 bytes kept
Inside HASH160Once, before RIPEMD-160
Taproot tagged hashesOnce, with a tag prefix
Share this guide
Share on X ↗

Key takeaways

  • SHA-256 produces a 32-byte hash.
  • Bitcoin often hashes twice (HASH256).
  • It secures block IDs, txids, merkle trees and checksums.

Common questions

Has SHA-256 ever been broken?

No practical attack is known against SHA-256 as used in Bitcoin.

Does mining use double SHA-256?

Yes, miners compute HASH256 of the 80-byte block header.

Is SHA-256 the same as Bitcoin mining?

Mining is the repeated computation of double SHA-256 on block headers, searching for a hash below the target.

Who designed SHA-256?

The US National Security Agency; it was published as a standard by NIST in 2001 and is widely analysed publicly.