Hash of a Hash Calculator

Calculate sha256(sha256(input)), the exact double-hashing construction Bitcoin uses for block header hashes and transaction IDs, specifically to defend against a length-extension-style attack class, not as generic 'extra security.' A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-25

Overview

Introduction

Bitcoin doesn't just SHA-256 its block headers and transactions once, it hashes the result a second time, a deliberate design choice with a specific cryptographic reason behind it, not just "more hashing equals more secure."

This tool computes that exact double SHA-256 construction, sha256(sha256(input)), for any text you provide, entirely in your browser.

What Is Hash of a Hash Calculator?

Double SHA-256 (sometimes written SHA256d or SHA256²) is simply SHA-256 applied to its own output: first hash the input, then hash that 32-byte digest again, producing a final 32-byte (64 hex character) result.

It's most famously the exact construction Bitcoin's protocol uses for both block header hashing and transaction ID computation, specified by Satoshi Nakamoto in the original design.

How Hash of a Hash Calculator Works

Your UTF-8 encoded text is hashed once with SHA-256, producing a 32-byte intermediate digest.

That intermediate digest (the raw bytes, not the hex string) is hashed again with SHA-256, and the final 32-byte result is hex-encoded into the 64-character output this tool returns.

When To Use Hash of a Hash Calculator

Use this when reproducing a Bitcoin-style double-hashed value, studying how Bitcoin's block header or transaction ID hashing works, or matching a system that specifically documents using SHA256d.

Don't reach for double-hashing as a general "make my hash more secure" technique elsewhere, it defends against a specific length-extension attack class, not brute force, and single SHA-256 is already the right general-purpose choice for most non-Bitcoin-specific needs.

Features

Advantages

  • Concretely defeats length-extension attacks against the underlying Merkle–Damgård construction, unlike a single SHA-256 pass.
  • Exactly matches Bitcoin's well-documented, widely implemented block and transaction hashing construction.
  • Simple and cheap to compute, just two SHA-256 passes, no additional algorithm needed.

Limitations

  • Does not meaningfully increase resistance to brute-force guessing for a fixed algorithm and input; it is not a substitute for a deliberately slow password-hashing function like bcrypt or Argon2.
  • Specific to defending against length-extension attacks, a property single SHA-256 already lacks but that matters far less for most applications than Bitcoin's specific protocol design.
  • Doubling computation cost for genuinely no benefit outside the length-extension-defense use case, unnecessary overhead if you don't actually need it.

Examples

Double-hashing a short greeting

Input

Hello, world!

Output

6246efc88ae4aa025e48c9c7adc723d5c97171a1fa6233623c7251ab8e57602f

sha256(sha256("Hello, world!")): the inner hash's raw bytes are re-hashed to produce this final digest.

Double-hashing the classic three-character test string

Input

abc

Output

4f8b42c22dd3729b519ba6f68d2da7cc5b2d606d05daed5ad5128cc03e6c6358

A second independent test vector for confirming any SHA256d implementation matches this exact double-hashing construction.

Best Practices & Notes

Best Practices

  • Use double SHA-256 specifically to reproduce or interoperate with Bitcoin-style hashing, not as a generic "stronger hash" technique elsewhere.
  • For password storage, use a dedicated slow hash like bcrypt or Argon2, not double (or any number of) SHA-256 passes, iteration count alone without memory-hardness or per-guess cost tuning doesn't provide the same protection.
  • If you need length-extension-attack resistance for a new design, consider a hash that's structurally immune to it in the first place, like SHA-3 (a sponge construction), rather than double-hashing SHA-2.

Developer Notes

Implemented as sha256(sha256(UTF8(input))) via @noble/hashes, feeding the first pass's raw 32-byte digest directly into the second SHA-256 call rather than re-hashing its hex string representation, matching Bitcoin's exact SHA256d construction. Verified against two independently computed test vectors (Node's built-in crypto module) for 'Hello, world!' and 'abc'.

Hash of a Hash Calculator Use Cases

  • Reproducing a Bitcoin-style block header or transaction ID hash by hand
  • Studying or teaching why Bitcoin specifically double-hashes rather than using single SHA-256
  • Verifying a SHA256d implementation against known double-hash test vectors
  • Comparing double-hashing's length-extension defense against genuine password-hashing techniques like bcrypt

Common Mistakes

  • Assuming double-hashing provides generic "extra security" or meaningfully slows brute-force attacks; it specifically defends against length-extension attacks, nothing more.
  • Re-hashing the first pass's hex string representation instead of its raw bytes, a common bug that produces a different, non-standard result from Bitcoin's actual SHA256d construction.
  • Using double SHA-256 as a substitute for a real password-hashing function like bcrypt or Argon2.

Tips

  • If you just need a plain SHA-256 digest without the double-hash, this category's SHA-256 Hash Calculator computes that single pass directly.
  • For genuine password-hashing needs, use this category's Bcrypt Hash Calculator instead, it's designed to be deliberately and tunably slow, which double SHA-256 is not.

References

Frequently Asked Questions