Crypto

What is a Merkle tree?

A Merkle tree summarises many items into one hash. Learn what a Merkle tree is, how it is built from hashes, and why blockchains rely on the Merkle root.

What is a Merkle tree?

Quick answer

A Merkle tree is a way of summarising many pieces of data into a single hash, called the Merkle root, by repeatedly hashing pairs of items. Change any one item and the root changes, so it is a compact, tamper-evident fingerprint that blockchains use to commit to a block's transactions.

Key points

  • A Merkle tree condenses many items into one hash, the Merkle root, by hashing pairs
  • Changing any single item changes the root, making tampering easy to detect
  • Blocks store the Merkle root to commit to all their transactions at once
  • A short Merkle proof shows a transaction is included without the whole block
  • This is what lets lightweight wallets verify payments, Satoshi's SPV

A Merkle tree is a way of summarising many pieces of data into a single fingerprint, by repeatedly hashing pairs of items until only one hash is left. That final hash, called the Merkle root, stands for the entire set: change any one item and the root changes, so the root is a compact, tamper-evident summary of everything underneath it.

Merkle trees are one of the quiet building blocks that make blockchains work, and they are the reason a lightweight wallet can verify a transaction without downloading the whole chain. This article explains what a Merkle tree is, how it is built from hashes, and why blockchains rely on it.

Start with the hash

A Merkle tree is built entirely out of hashes, so it helps to recall what a hash does. A cryptographic hash function takes any input and produces a fixed-length string that is effectively unique to that input. Change a single character and the output changes completely, and you cannot run the process backwards to recover the input. Those two properties — sensitivity to change and one-way behaviour — are what a Merkle tree exploits.

How a Merkle tree is built

Building a Merkle tree is a repetitive, bottom-up process:

  • Hash each item. Start with your data items, for example the transactions in a block, and hash each one. These are the leaves of the tree.
  • Pair and hash. Take the leaves two at a time, join each pair, and hash the result. You now have half as many hashes.
  • Repeat. Keep pairing and hashing the results, level by level, halving the count each time.
  • Reach the root. Eventually one hash remains. That is the Merkle root, and it represents every item at the bottom.

Because each level feeds into the one above, a change to any single leaf ripples upward and alters the root. That is the tamper-evidence: you cannot quietly swap out one transaction without the root no longer matching.

Why blockchains use Merkle trees

In a blockchain, each block contains many transactions. Rather than storing a plain list, the block header records the Merkle root of those transactions. This does two important jobs.

First, it locks the transactions in. Since the root is part of what gets hashed into the block and chained to the next one, altering any transaction would break the block’s hash and the links after it. This is part of what makes a confirmed transaction hard to tamper with.

Second, and more subtly, it enables efficient verification. Bitcoin’s original whitepaper describes using a Merkle tree so that old transaction data can be compacted and so that payments can be verified without running a full node. That second use is worth spelling out.

The Merkle proof: verifying without the whole chain

Suppose you want to prove that a particular transaction is included in a block, but you do not want to download every transaction in it. A Merkle tree lets you do this with a short piece of evidence called a Merkle proof, or Merkle branch.

Instead of every transaction, you only need the handful of “sibling” hashes along the path from your transaction up to the root. Starting with your transaction’s hash, you combine it with each supplied sibling, level by level, and if you arrive at the same Merkle root the block header advertises, your transaction must have been included. If even one item had been altered, the recomputed root would not match.

This is what allows a lightweight client to check a payment while trusting only the block headers. Satoshi Nakamoto’s whitepaper calls this Simplified Payment Verification, and it is why your phone wallet doesn’t need hundreds of gigabytes of chain data to confirm you were paid.

Walking through it once makes the idea stick. Say a block contains eight transactions and you care about the third. To prove it is included, you do not need the other seven transactions — you need three sibling hashes: the neighbour of your transaction at the bottom, then the combined hash of the next pair, then the combined hash of the far half of the tree. You hash your transaction with the first sibling, hash that result with the second, then with the third, and compare the answer to the block header’s Merkle root. A match proves inclusion; a mismatch proves something is off. The number of hashes you need grows with the height of the tree, not with the number of transactions, which is the whole point.

Why the design is efficient

The efficiency comes from the tree’s shape. As you double the number of items, the height of the tree grows by only one level, so the number of hashes in a proof grows very slowly compared with the amount of data it covers. In practical terms, you can prove membership in a set of thousands of transactions with only a small number of hashes. This logarithmic relationship — data doubling but proof size rising by a single step — is what keeps verification cheap even as blocks fill with more and more transactions, and it is the property that makes the whole approach scale.

What you want Without a Merkle tree With a Merkle tree
Prove a transaction is in a block Download and check every transaction Check a short branch of hashes up to the root
Detect tampering Compare full data Compare a single root hash

Ethereum extends the same idea with a more elaborate structure sometimes called a Merkle Patricia trie, which lets it commit not just to a list of transactions but to the whole state of accounts and balances in a similarly verifiable way. That means a single root hash in an Ethereum block header can vouch for the entire state of the network, so anyone can prove a specific account balance without trusting the party telling them.

The security of all this rests entirely on the hash function underneath. Because a good hash makes it infeasible to find two different inputs with the same output, an attacker cannot craft a fake transaction that hashes to the same value as a real one and slip it into the tree unnoticed. The Merkle tree does not add security of its own; it packages the hash function’s guarantees into a shape that is efficient to verify.

Beyond blockchains

You will meet the same idea outside crypto too. Version-control systems, distributed databases and file-sharing protocols use Merkle trees to compare large data sets quickly and to detect corruption, because a single differing root instantly signals that something underneath has changed. The blockchain use is just the most visible example of a much older, general technique for making large collections of data verifiable without re-checking every byte.

What this means

You will rarely interact with a Merkle tree directly, but it underpins things you rely on every day in crypto. It is the reason a block can commit to all its transactions with one small hash, the reason tampering is easy to detect, and the reason lightweight wallets can verify payments without the entire chain. In short, a Merkle tree turns “trust me, this data is unchanged” into something you can check with a single fingerprint. That quiet efficiency is a big part of why blockchains can stay verifiable as they grow.

Sources

  1. Bitcoin whitepaper — Nakamoto (Merkle trees, SPV)
  2. Investopedia — Merkle Tree

Frequently asked questions

What is a Merkle tree in simple terms?

It is a structure that summarises many items into one hash, the Merkle root, by repeatedly hashing pairs. Changing any item changes the root, so the root is a tamper-evident fingerprint of all the data.

What is a Merkle root?

The Merkle root is the single hash at the top of a Merkle tree that represents every item beneath it. Blockchains store it in the block header to commit to all of a block's transactions at once.

Why do blockchains use Merkle trees?

They make tampering easy to detect and let lightweight wallets verify that a transaction is in a block using a short Merkle proof, without downloading the entire chain.

Last reviewed: 26 Aug 2026 Next review: 26 Feb 2027 Section: Crypto
Liam Chen
Protocol & security writer · Blockchain mechanics, wallet security, cryptography

Liam Chen writes about how crypto works at the protocol level — consensus, cryptography, wallets and security. He explains mechanisms plainly and cites primary sources.

More by Liam Chen

Related

Crypto

What is Layer 2 in crypto?

Layer 2 in crypto is a network built on top of a main blockchain to cut fees and boost speed.…

Liam Chen · Aug 26, 2026 · 5 min
Crypto

What is a multisig wallet?

A multisig wallet needs more than one key to approve a transaction. Learn what a multisig wallet is, how the…

Liam Chen · Aug 26, 2026 · 6 min