Merkle Tree Calculator
Enter leaves, choose a hash, and see the Merkle root plus every level's hashes.
-
1Enter data
Enter content, paste text or load a file from disk. -
2Click the button
The tool will immediately process your data in the browser. -
3Get the result
Copy the finished text or save the file to your device.
return "Result ready in 0.1s";
}
Rate this tool:
Related tools
Other tools you may find usefulHow to Use the Merkle Tree Calculator
In the text box, enter leaves, one per line. By default, the values are alice, bob, carol, dave, eve. Each line is treated as a separate leaf of the tree.
Choose the hash function: SHA-256 (default) or double SHA-256, labeled as the Bitcoin-style variant. Then click Build Tree. The tree also builds automatically on load, so you can see the result for the default data immediately.
You get a table with hashes for the leaves and each following level, the full Merkle root, and expandable sections with the full hashes for every level. For the default data and SHA-256, the Merkle root is e74803b81d9746b5dd7ca1e23372d20cb5c98b6ed6462537305b40611b7cf3e7. The tool runs in your browser and does not send data to a server.
If you want to test your own data, replace the default lines with your own values. Each line is one leaf, so the number of lines affects the number of tree levels. After changing the data, click the button again to see the new root.
How Leaves and the SHA-256 Hash Function Work
A leaf is a single text entry from your list. A SHA-256 hash is calculated from each leaf. For example, for the default text alice, the hash begins with 2bd806c97f0e…, and for bob it begins with 81b637d8fcd2…. This shows that even at the leaf level, each value has its own unique hash.
SHA-256 belongs to the family of hash functions. It turns any text into a fixed-length result written as a string of characters. The same text always produces the same hash, but you cannot reconstruct the text from the hash alone. In a Merkle tree, hashes are not just calculated separately: they are combined with each other.
A parent node is created by concatenating the hash bytes of the left child and the hash bytes of the right child, then calculating the hash of that concatenation. The process repeats level by level until one root remains. As a result, the Merkle root represents the entire set of leaves, and changing one leaf affects all subsequent levels and the final result.
In practice, you do not need to calculate anything by hand. Just enter the texts, and the tool calculates the leaf hashes and combines them level by level. This lets you focus on comparing results instead of manually concatenating strings.
How Double SHA-256 Differs from Regular SHA-256
Regular SHA-256 calculates the hash once. Double SHA-256 calculates the hash twice: first from the data, then from the result of the first calculation. Put simply, it is SHA-256 of SHA-256 of the given text or concatenated bytes.
In the calculator, the choice applies to the entire tree. When you select SHA-256, the leaves and all parent nodes use a single SHA-256. When you select double SHA-256, both the leaves and every parent node are calculated twice.
Double SHA-256 is mainly associated with Bitcoin, where it is used in many elements related to transactions and addresses. In this tool, you can compare both variants on the same leaves and see how the Merkle root changes. This is useful when you want to check whether a particular calculation method matches your example.
When choosing an option, look at the label: SHA-256 is a single calculation, and double SHA-256 is the Bitcoin-style variant. The results for the same leaves will differ because even the first hash is calculated differently. Comparing both options helps you understand why changing the hash function alone changes the entire root.
Duplicating the Last Node with an Odd Number of Leaves
At each level, nodes are combined in pairs. When the number of nodes is odd, the last node has no pair. It is then duplicated and combined with itself. The parent hash is created from concatenating the left child's bytes and the same bytes on the right side.
This allows the tree to continue being built until one root remains. In the default example, there are five leaves, so an odd number of nodes appears at the first level. The last one is duplicated, making it possible to create the next level and reach the root.
It is worth knowing that duplicating the last node is one possible convention. Other Merkle tree implementations may use different rules. This calculator uses this approach, so its result is consistent with the described tree-building method.
In the table, you will see that at the first level the number of nodes is smaller than the number of leaves. This is due to pairing. Duplicating the last node ensures that no node is skipped and all leaves influence the final root.
Limitations: Bitcoin Byte Order and No Full Block Compatibility
The calculator builds a Merkle tree from the texts you enter. It is not a full Bitcoin block analyzer. It does not read block headers, parse transactions, verify signatures, or recalculate an entire block. You get a Merkle root for your own leaves, not a ready interpretation of network data.
In Bitcoin, hashes are often written in reverse byte order. This tool does not reverse them. If you want to compare the result with data stored in the format used by Bitcoin, you must account for that difference yourself. The root itself may be correct for the given leaves, but its representation may not be identical to what you see in block explorer tools.
The calculator supports only SHA-256 and double SHA-256. It does not automatically convert transactions to binary, does not recognize block structure, and does not confirm that data came from a real chain. If you need to replicate the full Bitcoin process, prepare the exact same bytes in the correct order and compare the result step by step.
Remember that the tool is not for sending transactions, does not connect to the network, and does not verify whether the data matches a real block. It is a calculator for learning and testing your own sets of leaves. If you use it for learning or comparisons, always save which leaves and which hash function you chose so you can reproduce the result later.
Frequently Asked Questions
What is a Merkle tree calculator?
It is a tool that builds a Merkle tree from a list of texts and shows the hashes of the leaves, each following level, and the root. You enter leaves, choose a hash function, and see the result immediately.
How do I calculate a Merkle root for several values?
Enter each value on its own line, choose SHA-256 or double SHA-256, and click Build Tree. The tool combines the hashes level by level until one root remains.
Does the Merkle tree calculator send data to a server?
No. The tool runs in your browser and does not send data to a server, so the leaves you enter stay with you. Calculations are performed locally.
What is the difference between SHA-256 and double SHA-256?
SHA-256 calculates the hash once, while double SHA-256 calculates it twice. In the calculator, you can choose both variants and compare their effect on the Merkle root.
What happens when the number of leaves is odd?
The last node at a given level is duplicated and combined with itself. This allows the tree to continue being built until one root remains.
Can the calculator's result be compared with a Merkle root in Bitcoin?
You can calculate the root for the same data, but Bitcoin often stores hashes in reverse byte order. This tool does not reverse them, so account for that difference yourself when comparing.
See also — related tools
This tool calculates locally in your browser, and results are illustrative—for Bitcoin use, check the data format and byte order.