SHAGenerator
Fundamentals

How Long Is a SHA-256 Hash?

A precise dimensional breakdown of SHA-256 across bits (256), bytes (32), hexadecimal characters (64), Base64 characters (44), and database column storage.

Category: FundamentalsReading Time: 4 min readPublished: 2026-08-20

1. Dimensional Breakdown Across Encodings

• Raw Binary: Exactly 256 bits (zeros and ones). • Byte Array: Exactly 32 bytes (`Uint8Array(32)`). • Hexadecimal Representation: Exactly 64 characters (each byte is 2 hex nibbles `0-9, a-f`). • Base64 Representation: Exactly 44 characters (including trailing `=` padding). • Base58 (Bitcoin style): Typically 43-44 characters without ambiguous characters (0, O, I, l).

2. Database Storage Optimization

When storing millions of SHA-256 hashes in a relational database (PostgreSQL, MySQL, SQLite): • Storing as `VARCHAR(64)` uses 64 bytes of disk storage per row. • Storing as raw binary `BINARY(32)` or `BYTEA` uses exactly 32 bytes per row—reducing B-Tree index size and RAM caching overhead by 50%.

Frequently Asked Questions.

Frequently Asked Questions

Clear answers to common cryptographic and implementation questions.

Can a SHA-256 hash ever have fewer or more than 64 hex characters?
No. SHA-256 always produces a fixed 32-byte digest regardless of whether the input is 0 bytes or 100 gigabytes.

Recommended Tools for this Topic

View all tools →