What Is Hashing? Hash Functions Explained (No Math Degree Needed)
A plain-English guide to hashing: what a hash function is, how it turns data into a fixed fingerprint, and why hashes power passwords, checksums and integrit...

Hashing turns any piece of data (a word, a file, a whole database) into a short fixed-length string called a hash. A hash function does the work: feed it “hello” and it always spits back the same fingerprint, but you can never run the process backward to recover “hello” from the fingerprint. That one-way property is what makes hashing so useful for passwords, file checks, and integrity.
If you have ever downloaded a file and seen a long string of letters and numbers labeled “SHA-256”, you have already met a hash. This guide explains what is happening under the hood, in plain English, with real values you can reproduce.
What is a hash function? (a one-way fingerprint for data)
A hash function is a piece of math that takes an input of any size and returns an output of a fixed size. That output is the hash value, sometimes called a digest or just “the hash”.
Think of it like a fingerprint for data. A person can be tall or short, but their fingerprint is always the same small, standard size. Change one detail about the input and the fingerprint changes completely. The same idea drives hashing: “cat” and “cats” produce two hashes that look nothing alike, even though the inputs differ by a single letter.
The key word is one-way. You can go from input to hash instantly. Going from hash back to input is meant to be practically impossible. That is the whole point, and it is what separates hashing from encoding or encryption, which we will get to below.
How does hashing work, step by step
At a high level, every hash function follows the same shape. Here is what happens when you hash the text “hello” with SHA-256.
- Convert the input to bytes. Text becomes a sequence of numbers using a character encoding. If you are fuzzy on how letters become bytes, our note on UTF-8 vs ASCII covers it. “hello” becomes the byte values 104, 101, 108, 108, 111.
- Pad the data to a fixed block size. The algorithm adds padding so the total length fits neatly into blocks (512 bits for SHA-256).
- Mix the bits in rounds. The function runs the blocks through dozens of rounds of shifting, adding, and combining. Each round scrambles the state a little more.
- Output the final digest. After the last round, you get a fixed-size result. For SHA-256 that is always 256 bits, no matter how big or small the input was.
Hash “hello” with SHA-256 and you get:
2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824
Hash the entire text of a novel and you still get exactly 64 hex characters. That fixed-length output is a defining trait of any hashing algorithm.
The properties every good hash has
Not every scrambling function makes a good hash. A solid hash function needs four properties working together.
Deterministic. The same input always produces the same hash. Hash “hello” today, next year, or on a different computer, and you get that same string above. Without this, hashes would be useless for verification.
Fast to compute. Hashing a file should take milliseconds, not minutes. You want to check integrity quickly, so speed matters (though for passwords we actually want the opposite, which we explain later).
Avalanche effect. A tiny change in the input flips roughly half the output bits. Change “hello” to “Hello” (capital H) and the SHA-256 result becomes:
185f8db32271fe25f561a6fc938b2e264306ec304eda518007d1764826381969
Completely different. There is no visible link between the two hashes, even though the inputs differ by one bit of one letter.
One-way (preimage resistance). Given a hash, you cannot feasibly work out the original input. The only real attack is guessing inputs and hashing them until one matches, which is why weak passwords fall fast and long random ones do not.
A fifth property matters for security work: collision resistance, meaning it should be hard to find two different inputs with the same hash. When that breaks, the algorithm is considered broken. We go deep on this in hash collision explained.
What is a cryptographic hash function vs a plain hash
Not all hashes are built for security. There are two broad families, and mixing them up causes real bugs.
A plain (non-cryptographic) hash is built for speed and even distribution, not safety. Functions like CRC32 or the hash behind a language’s dictionary or hash map fall here. They are great for spreading keys across buckets or catching accidental data corruption. They are trivial to reverse or collide on purpose, so never use them for passwords or signatures.
A cryptographic hash function adds strong guarantees: preimage resistance, collision resistance, and the avalanche effect. SHA-256 is the workhorse example. These are the ones you want any time an attacker might try to fool the system.
The short rule: if a human adversary could benefit from breaking it, use a cryptographic hash. If you just need to sort data into buckets or spot random corruption, a plain hash is fine and faster.
Common algorithms at a glance: MD5, SHA-1, SHA-256, bcrypt
| Algorithm | Output size | Status | Use it for |
|---|---|---|---|
| MD5 | 128-bit (32 hex chars) | Broken (collisions found) | Non-security checksums only |
| SHA-1 | 160-bit (40 hex chars) | Broken (deprecated 2017) | Legacy, avoid for new work |
| SHA-256 | 256-bit (64 hex chars) | Strong | Integrity, signatures, checksums |
| bcrypt | 184-bit (with salt) | Strong | Password storage |
MD5 still shows up for quick file checks, but it must never guard anything an attacker cares about. If you are choosing between the two most common file-check options, SHA-256 vs MD5 walks through when each is acceptable.
bcrypt is the odd one out here on purpose. It is deliberately slow and adds a random salt to every password, which defeats precomputed lookup tables. Speed is a feature for checksums and a liability for passwords, so password hashing uses a different toolset.
What a hash value actually looks like (and why it’s hexadecimal)
A hash value is just a big number. SHA-256 produces 256 bits, which is a number with 78 digits in decimal. Nobody wants to read that, so we display it in hexadecimal instead.
Hex uses 16 symbols (0 through 9, then a through f), and each hex character represents exactly 4 bits. That makes the mapping clean: 256 bits divided by 4 equals 64 hex characters, every time. The MD5 hash of “hello” is 5d41402abc4b2a76b9719d911017c592, which is exactly 32 hex characters, or 128 bits.
You will sometimes see hashes shown in Base64 instead, which packs the same bits into fewer characters using a larger alphabet. That is an encoding choice, not a different hash. If the distinction is new to you, what is Base64 encoding explains how the same bytes get a different-looking wrapper.
Where hashing shows up: passwords, checksums, deduplication, blockchains
Hashing is everywhere once you know the fingerprint pattern. Four common jobs:
Passwords. Sites should never store your actual password. They store a salted hash of it. When you log in, they hash what you typed and compare. If their database leaks, attackers get hashes, not passwords (assuming the site did it right with bcrypt or similar).
Checksums and integrity. Download a Linux ISO and the site lists its SHA-256. You hash your copy and compare the two strings. Match means the file arrived intact. One flipped bit and the hash is wildly different, so tampering or corruption is obvious. See what is a checksum for the full workflow.
Deduplication. Backup systems and cloud storage hash every file. Two files with the same hash are almost certainly identical, so the system stores the data once and points both names at it. This saves huge amounts of space.
Blockchains. Each block contains the hash of the previous block. Change any old transaction and its hash changes, which breaks every block after it. That chained dependency is what makes tampering detectable.
What hashing is NOT (it’s not encryption, it’s not reversible)
This is the single most common confusion, so let’s be blunt about it.
Hashing is not encryption. Encryption is two-way: you encrypt with a key and decrypt with a key to get the original back. Hashing has no key and no decrypt step. There is no “unhash” button because the process throws information away by design.
Hashing is not encoding either. Encoding (like Base64 or URL encoding) reshapes data into a safe format and is fully reversible by anyone. A hash is a lossy, one-way fingerprint. If someone tells you they will “decode” a hash to recover the input, they are either guessing from a lookup table or mistaken.
Hashing is not compression. A 4 GB video and a one-line note both produce a 64-character SHA-256 hash. You cannot reconstruct the video from 64 characters, so the hash is a fingerprint, not a smaller copy of the data.
Try it yourself: generate a SHA-256 hash of any text
The fastest way to make hashing click is to hash something and watch the output. Type your name, hash it, then change one letter and hash again. You will see the avalanche effect in action: two inputs that differ by a single character produce two hashes with nothing in common.
Use our hash generator to compare SHA-256, SHA-512, SHA-1, and MD5 without installing anything. It runs locally in your browser, so the text you test never leaves your device.
FAQ
Can a hash be reversed back to the original data? No. A good hash function is one-way by design. The only way to find an input for a given hash is to guess inputs and hash them until one matches, which is why weak or short inputs are vulnerable and long random ones are safe.
Is hashing the same as encryption? No. Encryption is reversible with a key so you can recover the original. Hashing has no key and no way back. Use encryption when you need the data again later, and hashing when you only need to verify or fingerprint it.
Why do two different files sometimes get the same hash? That is a collision, and for a strong algorithm like SHA-256 it is so rare it never happens by accident. MD5 and SHA-1 have known ways to force collisions on purpose, which is why they are considered broken for security. See hash collision explained for the details.
Which hashing algorithm should I use? For file integrity and checksums, use SHA-256. For storing passwords, use a slow, salted function like bcrypt. Avoid MD5 and SHA-1 for anything an attacker could benefit from breaking.