Skip to content
Private: files never leave your device

Hash Length Chart: Bits, Bytes and Characters

How long each common hash is, in every form you meet it: bits from the standards, bytes in memory, hexadecimal characters in a checksum file and Base64 characters in an API or header. Use it to size a database column or to work out which algorithm produced a hash you were given.

Hash lengths in hexadecimal: MD5 is 32 characters, SHA-1 is 40, SHA-256 is 64 and SHA-512 is 128, from NIST FIPS 180-4, FIPS 202 and RFC 1321

An MD5 hash is 128 bits, written as 32 hexadecimal characters; SHA-1 is 160 bits or 40 characters; SHA-256 is 256 bits or 64 characters; and SHA-512 is 512 bits or 128 characters. The length is fixed by the algorithm, so a hash of one letter and a hash of a 4 GB file are exactly the same length. Digest sizes below come from NIST FIPS 180-4, NIST FIPS 202 and RFC 1321, and the encoded lengths were checked by hashing the text abc with Node.js on 24 November 2026.

Hash length table

Hex is the form shown by most checksum tools and download pages. RFC 4648 describes hex, or Base16, as 2 characters for every byte, so hex length is always twice the byte length. Base64 lengths include = padding; base64url without padding is shown in the last column.

AlgorithmBitsBytesHex charactersBase64 charactersbase64url, no padding
MD512816322422
SHA-116020402827
SHA-22422428564038
SHA-25625632644443
SHA-38438448966464
SHA-512512641288886
SHA-512/22422428564038
SHA-512/25625632644443
SHA3-22422428564038
SHA3-25625632644443
SHA3-38438448966464
SHA3-512512641288886
SHAKE128, SHAKE256Chosen by the callerd / 8d / 44 x ceil(d / 24)ceil(d / 6)

FIPS 202 calls SHAKE128 and SHAKE256 extendable output functions: the output can be any length d that the application asks for, and a longer output simply extends a shorter one for the same message.

Identify a hash by its length

If someone hands you a hex string and does not say which algorithm made it, the length narrows it down. It cannot settle it completely, because several algorithms share an output size.

Hex charactersPossible algorithms
32MD5
40SHA-1
56SHA-224, SHA-512/224 or SHA3-224
64SHA-256, SHA-512/256 or SHA3-256
96SHA-384 or SHA3-384
128SHA-512 or SHA3-512

To be sure, hash a sample with each candidate in the Hash Generator, which shows MD5, SHA-1, SHA-256, SHA-384, SHA-512 and SHA3-256 side by side, and see which output matches.

Block size and message limits

The digest is only one of the sizes in the standards. FIPS 180-4 Figure 1 lists the block and word sizes the algorithms work on, and the largest message they accept. The block size matters for HMAC, where it is the B value in the key padding, and FIPS 202 Table 3 gives it for SHA-3.

AlgorithmBlock sizeWord sizeMaximum message
SHA-1, SHA-224, SHA-256512 bits (64 bytes)32 bitsLess than 264 bits
SHA-384, SHA-512, SHA-512/224, SHA-512/2561024 bits (128 bytes)64 bitsLess than 2128 bits
SHA3-224144 bytesNot applicableAny bit length
SHA3-256136 bytesNot applicableAny bit length
SHA3-384104 bytesNot applicableAny bit length
SHA3-51272 bytesNot applicableAny bit length

Worked examples for the text abc

Each of these is the hex form of hashing the three characters abc, with no line break. Count the characters and you get the table values: 32, 40 and 64.

AlgorithmHash of abc
MD5900150983cd24fb0d6963f7d28e17f72
SHA-1a9993e364706816aba3e25717850c26c9cd0d89d
SHA-256ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad

Sizing a database column

  • Store raw bytes when you can: BINARY(16) for MD5, BINARY(20) for SHA-1 and BINARY(32) for SHA-256 hold the digest at half the hex size.
  • If you store hex, use a fixed CHAR column of the hex length, such as CHAR(64) for SHA-256, and pick one letter case, because RFC 4648 treats hex as case insensitive but string comparison often is not.
  • Base64 is shorter than hex, 44 characters against 64 for SHA-256, but Base64 is case sensitive, so never lower-case it.
Password hashes are different A stored password hash often carries a salt and algorithm settings alongside the digest, so its length will not match this table. That is expected and not a sign of a broken hash. For choosing the password itself, see our guide to creating a strong password.

Which lengths are still safe

Length is not the same as strength. RFC 6151 says MD5 is no longer acceptable where collision resistance is required, such as digital signatures. NIST says federal agencies should stop using SHA-1 for generating digital signatures, and its policy page sets 31 December 2030 as the date after which FIPS 140 validated modules still using SHA-1 move to the historical list. RFC 6151 adds that it is not urgent to stop using MD5 in other ways, and NIST still allows SHA-1 for some uses such as HMAC. For new work, and for anything where someone might forge a file on purpose, choose SHA-256 or longer.

Sources and dates

SourceCheckedUsed for
NIST FIPS 180-4: Secure Hash Standard24 November 2026SHA-1 and SHA-2 digest, block, word and message sizes (Figure 1)
NIST FIPS 202: SHA-3 Standard24 November 2026SHA-3 output sizes (Table 4), HMAC block sizes (Table 3), SHAKE output
RFC 1321: The MD5 Message-Digest Algorithm24 November 2026MD5 128-bit digest
RFC 4648: Base16, Base32 and Base6424 November 20262 hex characters per byte, Base64 and base64url
RFC 6151: Updated security considerations for MD524 November 2026MD5 not acceptable where collision resistance is needed
NIST: Policy on hash functions24 November 2026SHA-1 signature guidance and the 2030 transition

Frequently asked questions

How long is an MD5 hash?

128 bits, which is 16 bytes or 32 hexadecimal characters. In Base64 it is 24 characters with padding.

How many characters is a SHA-256 hash?

64 hexadecimal characters, because SHA-256 produces 256 bits, or 32 bytes, and hex uses 2 characters per byte. In Base64 it is 44 characters.

Which hash is 40 characters long?

Among the standard algorithms in this chart, only SHA-1 gives 40 hex characters, because it produces 160 bits, or 20 bytes.

Does a longer input give a longer hash?

No. Each algorithm has a fixed output size, so SHA-256 of one letter and SHA-256 of a large file are both 64 hex characters.

Is a 64 character hash SHA-256 or SHA3-256?

It can be either, or SHA-512/256, since all three produce 256 bits. Hash a known sample with each to see which one matches.