SHA Hash Length Calculator
Get digest length, hex and Base64 output size, block size and collision resistance for any SHA-1, SHA-2 or SHA-3 variant.
About SHA Hash Length Calculator
SHA-2 uses Merkle–Damgård padding: a 0x80 marker plus a 64-bit (SHA-224/256) or 128-bit (SHA-384/512) length field, padded to a whole block. SHA-3 is a sponge, so its absorbing rate shrinks as the digest grows, and collision resistance in both families is half the digest length because of the birthday bound. Column widths, HSM buffers and token size limits all depend on the exact hex or Base64 length, and picking a digest with under 128-bit collision resistance breaks any signature or dedup scheme built on it.
Formulas
SHA Hash Length
digest bytes = digest bits ÷ 8; hex chars = 2 × bytes; collision resistance = digest bits ÷ 2 (birthday bound); blocks = ⌈(message + padding) ÷ block size⌉.
- digest bits
- Output length fixed by the algorithm
- block size
- Bytes absorbed per compression (64 or 128 for SHA-2, the rate for SHA-3)
- padding
- 1 marker byte plus an 8- or 16-byte length field for SHA-2
Keccak rate
SHA-3 rate = 200 − 2 × (digest bytes), giving 136 bytes for SHA3-256 and 72 bytes for SHA3-512.
Worked example
With the default values below, SHA Hash Length Calculator returns Digest Length of 256. Change any input above and every figure here is recalculated in your browser.
Inputs used
- Hash algorithmone of SHA-1 (deprecated), SHA-224, SHA-256, SHA-384, SHA-512, SHA3-256, SHA3-512
- SHA-256
- Message lengthminimum 0 bytes
- 1,024 bytes
Results
- Digest Length
- 256 bits
- Hex String Length
- 64 chars
- Base64 Length
- 44 chars
- Block / Rate Size
- 64 bytes
- Collision Resistance
- 128 bits
- Compression Blocks Processed
- 17
- Assessment
- Strong — 128-bit collision resistance
Step by step
- 1Values used
- 2SHA Hash Length
- 3Keccak rate
- 4Digest Length= 256 bits
- 5Hex String Length= 64 chars
- 6Base64 Length= 44 chars
- 7Block / Rate Size= 64 bytes
- 8Collision Resistance= 128 bits
- 9Compression Blocks Processed= 17
Assumptions and limits
- The result is derived only from the 2 inputs listed above. Anything not among them is not part of the calculation.
- In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
- Figures are rounded for display to whole numbers, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.
How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.
Frequently Asked Questions
How is SHA Hash Length calculated?
digest bytes = digest bits ÷ 8; hex chars = 2 × bytes; collision resistance = digest bits ÷ 2 (birthday bound); blocks = ⌈(message + padding) ÷ block size⌉. SHA-2 uses Merkle–Damgård padding: a 0x80 marker plus a 64-bit (SHA-224/256) or 128-bit (SHA-384/512) length field, padded to a whole block. SHA-3 is a sponge, so its absorbing rate shrinks as the digest grows, and collision resistance in both families is half the digest length because of the birthday bound.
Why does SHA Hash Length matter?
Column widths, HSM buffers and token size limits all depend on the exact hex or Base64 length, and picking a digest with under 128-bit collision resistance breaks any signature or dedup scheme built on it.
What values do I need to enter?
This calculator takes 2 inputs: Hash algorithm, Message length. The pre-filled defaults are a realistic starting point — replace them with figures from your own environment for a result you can act on.
Why is SHA-512 sometimes faster than SHA-256?
SHA-512 works on 64-bit words and absorbs 128 bytes per block instead of 64, so on a 64-bit CPU without SHA-NI extensions it processes roughly 1.5× more bytes per second despite the larger digest.
Related Calculators
You might also need
- HMAC Output CalculatorCommonly used together
- Digital Signature Size CalculatorCommonly used together
- Hash Collision Probability CalculatorCommonly used together
- RSA Key Size CalculatorAlso in Cryptography
- Quantum Security Readiness CalculatorAlso in Cryptography
- AES Key Strength CalculatorAlso in Cryptography
