SHA-256 Explained: The Algorithm Behind Bitcoin Mining

SHA-256 Explained: The Algorithm Behind Bitcoin Mining

Short answer: SHA-256 is a cryptographic hash function that turns any input into a fixed 256-bit output, called a digest, that looks random but is always the same for the same input. It belongs to the SHA-2 family and is published by NIST in the Secure Hash Standard, FIPS 180-4. Bitcoin uses it for proof of work: miners hash an 80-byte block header twice with SHA-256 and check whether the result is at or below the network target. The “math” miners do is not equation solving but repeated guessing, trillions of hashes per second.

This guide explains what a hash function is, how SHA-256 behaves, how Bitcoin uses it, why specialized ASIC chips dominate SHA-256 mining, and which other coins and algorithms the miners we sell work with.

What is a hash function?

A hash function takes data of any size, such as a word, a file or a block of transactions, and produces a short, fixed-size result. Think of it as a fingerprint for data: easy to compute, always the same for the same input, and practically impossible to run backward.

A cryptographic hash function adds security requirements on top. It should be infeasible to find an input that produces a given output, or two different inputs that produce the same output. Those properties are what make hashes useful for passwords, digital signatures, file integrity checks and blockchains.

SHA-256 basics

SHA-256 is one of the SHA-2 hash functions. The SHA-2 family was developed by the US National Security Agency, and NIST publishes it as a federal standard. The current version is FIPS 180-4, the Secure Hash Standard (August 2015), which also specifies SHA-224, SHA-384, SHA-512 and others.

Property SHA-256 value (FIPS 180-4)
Output (message digest) 256 bits, usually written as 64 hexadecimal characters
Block size 512 bits; longer inputs are processed block by block
Word size 32 bits
Maximum input length Less than 2^64 bits
Internal work A schedule of 64 words, eight working variables and 64 constants, mixed with shifts, rotations, logic operations and additions

None of these steps is exotic. Each one is a simple operation on 32-bit words, repeated many times so that every bit of the output depends on every bit of the input. That simplicity is also why SHA-256 can be etched directly into silicon.

Properties of SHA-256, explained simply

  • Deterministic. The same input always gives the same digest. Any computer can check a result by hashing the same data again.
  • Fixed length. A single letter and an entire hard drive both produce a 256-bit digest.
  • Avalanche effect. Change one character of the input, or one bit, and the digest changes completely and unpredictably. There is no “close” answer; nearby inputs give unrelated outputs.
  • Preimage resistance. Given a digest, it is computationally infeasible to find an input that produces it. You can only guess and check.
  • Collision resistance. It is computationally infeasible to find two different inputs with the same digest, so a digest reliably identifies its data.

FIPS 180-4 states the last two properties directly: they are why the standard calls these algorithms “secure.”

How Bitcoin uses SHA-256

According to the Bitcoin developer reference, every block header is serialized into 80 bytes and hashed with SHA-256 twice, often written SHA256(SHA256()). The result is the block hash. A block is valid only if that hash, read as a number, is equal to or below the target encoded in the header.

The header holds the version, the hash of the previous block, a merkle root that commits to every transaction in the block, a timestamp, the encoded target and a 4-byte nonce. Miners change the nonce, and other adjustable data, on each attempt. Our guide what is a nonce in Bitcoin mining walks through every field.

Double SHA-256 also appears elsewhere in Bitcoin: transaction IDs, the merkle tree and the link from each block to the one before it. Every 2,016 blocks the network adjusts the target so that blocks keep arriving roughly every ten minutes as total mining power changes.

What math do Bitcoin miners actually solve?

Despite the phrase “solving complex math problems,” miners are not solving equations. There is nothing to solve in the algebra sense, because SHA-256 has no known shortcut that leads from the target back to a winning input.

What a miner does is closer to a lottery with a very simple rule:

  1. Build a block header.
  2. Hash it with double SHA-256.
  3. Compare the result with the target. If it is low enough, the block is found.
  4. If not, change the nonce and try again.

Because of the avalanche effect, each attempt is a fresh, independent guess. A lower target means more guesses are needed on average. So the “work” in proof of work is simply the number of hashes performed, and a miner’s speed is measured in hashes per second. See hashrate, terahash and J/TH explained for the units.

Why ASICs beat CPUs and GPUs at SHA-256

A CPU is built to run any program, and a GPU to run many general calculations in parallel. Both spend most of their transistors and power on flexibility that SHA-256 mining does not need. An ASIC (application-specific integrated circuit) is the opposite: a fixed-function chip whose circuits do nothing except compute SHA-256 hashes for block headers.

Bitcoin mining moved from CPUs to GPUs to FPGAs, and the first Bitcoin ASICs appeared in 2013. Each step left the older hardware unable to cover the cost of its electricity. Today’s SHA-256 ASICs are rated in terahashes per second, with efficiency measured in joules per terahash. Read what is an ASIC miner for how the chips and hashboards fit together.

Other SHA-256 coins

Bitcoin is not the only network secured by SHA-256. Bitcoin Cash (BCH) and Bitcoin SV (BSV) both descend from Bitcoin’s original software and kept the same proof of work: an 80-byte block header hashed with double SHA-256. Because the algorithm is identical, a SHA-256 ASIC can hash for any of these networks; you only need a pool or node for the coin you choose. For example, the Antminer S21 (200 TH/s, 3,500 W) is $1,401.75, Bitminers price at the time of writing (October 5, 2026), and its listing names Bitcoin, Bitcoin Cash and Bitcoin SV as supported coins. The same applies to the Antminer S23 (318 TH/s, 3,498 W) at $5,800.00. Bitminers does not guarantee mining profitability on any coin.

SHA-256 compared with other mining algorithms

Many proof-of-work coins use different algorithms, and an ASIC built for one cannot mine another. These are the algorithms used by miners in the Bitminers catalog:

Algorithm Coins (per catalog listings) Where to browse
SHA-256 Bitcoin (BTC), Bitcoin Cash (BCH), Bitcoin SV (BSV) Bitcoin miners
Scrypt Litecoin (LTC), Dogecoin (DOGE) Scrypt miners
kHeavyHash Kaspa (KAS) Kaspa miners
Equihash Zcash (ZEC) Antminer Z15
RandomX Monero (XMR) Other ASIC miners
Blake3 Alephium (ALPH) Alephium miners
zkSNARK Aleo (ALEO) Aleo miners

Scrypt is the most common alternative for Bitcoin miners to compare against; our guide to Scrypt miners explains how it differs. Unfamiliar terms are defined in the Bitcoin mining glossary.

Frequently asked questions

What is SHA-256 in simple terms?

It is a function that turns any data into a 256-bit fingerprint. The same data always gives the same fingerprint, a tiny change gives a completely different one, and the fingerprint cannot be turned back into the data.

Can SHA-256 be reversed or decrypted?

No. SHA-256 is a hash, not encryption, so there is no key and nothing to decrypt. Finding an input for a given digest is computationally infeasible; the only approach is guessing, which is exactly what miners do against a target rather than an exact value.

Which coins can a SHA-256 ASIC miner mine?

Any coin whose proof of work is SHA-256, such as Bitcoin, Bitcoin Cash and Bitcoin SV. It cannot mine Scrypt, kHeavyHash or other algorithms, because its chips are hard-wired for SHA-256.

Why does Bitcoin hash the block header twice?

Bitcoin’s design applies SHA-256 twice to the header, and the developer reference describes block hashes, transaction IDs and merkle roots in this double-SHA-256 form. For miners it simply means each attempt is two SHA-256 passes over the 80-byte header.

Is SHA-256 still secure?

NIST continues to list SHA-256 as an approved hash algorithm under FIPS 180-4, the current Secure Hash Standard, and it remains in wide use in security protocols as well as in Bitcoin.