What Is a Hash Function?
A hash function takes an input of any length and produces a fixed-length output called a hash (also called a digest or checksum). The output is deterministic — the same input always produces the same hash — but the relationship is one-directional: given a hash, you cannot calculate what the original input was (for secure hash functions).
Even a tiny change in the input produces a completely different hash output — this property, called the avalanche effect, makes hashing ideal for detecting any modification to data, however small.
Simple Example: The SHA-256 hash of "Hello" is 185f8db32921bd46d35b82d4e46f70f07d3928bf4e5fe3588e309ab66b04ff75. The SHA-256 hash of "hello" (lowercase h) is 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824 — completely different, even though only one character changed.
Hash Algorithms Compared
| Algorithm | Output Length | Speed | Security |
|---|---|---|---|
| MD5 | 128 bits (32 hex chars) | Fastest | Broken — collision attacks exist |
| SHA-1 | 160 bits (40 hex chars) | Fast | Deprecated — collision attacks exist |
| SHA-256 | 256 bits (64 hex chars) | Medium | Secure — current standard |
| SHA-384 | 384 bits (96 hex chars) | Slower | Very secure |
| SHA-512 | 512 bits (128 hex chars) | Slowest | Highest security |
How to Generate a Hash
Choose Hash Type
Select MD5, SHA-1, SHA-256, SHA-384, or SHA-512. For new projects, always use SHA-256 or higher.
Enter Text or Upload File
Type or paste text to hash, or upload a file. File hashing calculates the hash of the entire file's binary content.
Copy the Hash
The hash value generates instantly as you type. Copy the hex string for use in verification, comparison, or storage.
File Hash Verification — Confirming Download Integrity
Software distributors often publish the SHA-256 hash of their download files. After downloading, generate the SHA-256 hash of the downloaded file and compare it to the published hash. If they match exactly, the file is authentic and hasn't been tampered with. If they differ, the download is corrupt or has been modified.
- Verify Linux ISO downloads before installing
- Confirm software packages aren't corrupted after transfer
- Verify firmware files before flashing hardware
Hash Uses in Development
- Password storage: Store SHA-256 (or better, bcrypt/Argon2) hashes of passwords — never plaintext
- Cache keys: Hash request parameters to generate unique cache keys
- Checksums: Verify file integrity after upload, transfer, or storage
- ETag headers: Generate ETags for HTTP caching based on file content hashes
- Git: Every commit, tree, and blob in Git is identified by its SHA-1 hash
Generate Hash Free
MD5, SHA-1, SHA-256, SHA-384, SHA-512. Text and file input. Instant output.
Generate Hash NowHash vs Encryption — Important Distinction
Hashing is one-way — given a hash, you can't recover the original data. Encryption is two-way — data encrypted with a key can be decrypted back to the original. Never confuse the two: never "encrypt" passwords (because decryption is possible), always hash them (one-way, irreversible).
ToolMatrix Hash Generator
All major hash algorithms (MD5, SHA-1, SHA-256, SHA-384, SHA-512). Text and file input. Real-time hash generation as you type. One-click copy and verify (compare two hashes for equality). Browser-based — your data never leaves your device. Free, no account needed.