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.
| Algorithm | Bits | Bytes | Hex characters | Base64 characters | base64url, no padding |
|---|---|---|---|---|---|
| MD5 | 128 | 16 | 32 | 24 | 22 |
| SHA-1 | 160 | 20 | 40 | 28 | 27 |
| SHA-224 | 224 | 28 | 56 | 40 | 38 |
| SHA-256 | 256 | 32 | 64 | 44 | 43 |
| SHA-384 | 384 | 48 | 96 | 64 | 64 |
| SHA-512 | 512 | 64 | 128 | 88 | 86 |
| SHA-512/224 | 224 | 28 | 56 | 40 | 38 |
| SHA-512/256 | 256 | 32 | 64 | 44 | 43 |
| SHA3-224 | 224 | 28 | 56 | 40 | 38 |
| SHA3-256 | 256 | 32 | 64 | 44 | 43 |
| SHA3-384 | 384 | 48 | 96 | 64 | 64 |
| SHA3-512 | 512 | 64 | 128 | 88 | 86 |
| SHAKE128, SHAKE256 | Chosen by the caller | d / 8 | d / 4 | 4 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 characters | Possible algorithms |
|---|---|
| 32 | MD5 |
| 40 | SHA-1 |
| 56 | SHA-224, SHA-512/224 or SHA3-224 |
| 64 | SHA-256, SHA-512/256 or SHA3-256 |
| 96 | SHA-384 or SHA3-384 |
| 128 | SHA-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.
| Algorithm | Block size | Word size | Maximum message |
|---|---|---|---|
| SHA-1, SHA-224, SHA-256 | 512 bits (64 bytes) | 32 bits | Less than 264 bits |
| SHA-384, SHA-512, SHA-512/224, SHA-512/256 | 1024 bits (128 bytes) | 64 bits | Less than 2128 bits |
| SHA3-224 | 144 bytes | Not applicable | Any bit length |
| SHA3-256 | 136 bytes | Not applicable | Any bit length |
| SHA3-384 | 104 bytes | Not applicable | Any bit length |
| SHA3-512 | 72 bytes | Not applicable | Any 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.
| Algorithm | Hash of abc |
|---|---|
| MD5 | 900150983cd24fb0d6963f7d28e17f72 |
| SHA-1 | a9993e364706816aba3e25717850c26c9cd0d89d |
| SHA-256 | ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad |
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.
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
| Source | Checked | Used for |
|---|---|---|
| NIST FIPS 180-4: Secure Hash Standard | 24 November 2026 | SHA-1 and SHA-2 digest, block, word and message sizes (Figure 1) |
| NIST FIPS 202: SHA-3 Standard | 24 November 2026 | SHA-3 output sizes (Table 4), HMAC block sizes (Table 3), SHAKE output |
| RFC 1321: The MD5 Message-Digest Algorithm | 24 November 2026 | MD5 128-bit digest |
| RFC 4648: Base16, Base32 and Base64 | 24 November 2026 | 2 hex characters per byte, Base64 and base64url |
| RFC 6151: Updated security considerations for MD5 | 24 November 2026 | MD5 not acceptable where collision resistance is needed |
| NIST: Policy on hash functions | 24 November 2026 | SHA-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.