SHA256 Hash Generator — MD5, SHA-1 & SHA-512

Hashing runs entirely in your browser. No data is uploaded, logged, or stored.
Drop a file here or click to select

What is a Cryptographic Hash?

A cryptographic hash function takes an input of any size and produces a fixed-length string of characters — the digest — that looks random but is deterministic: the same input always produces the same output. Change a single bit and the digest changes completely, a property called the avalanche effect. Unlike Base64 encoding, hashing is a one-way operation. There is no key, no secret, and no way to reverse the process to recover the original input.

Hashes serve two purposes: integrity verification (confirming a file or message has not been altered) and commitment (proving you knew a value without revealing it). Passwords are stored as hashes so that a database leak does not expose the original credentials; downloads are published alongside checksums so you can verify the file arrived intact.

SHA-256 vs MD5 — Which Should You Use?

MD5 was designed in 1991 and produces a 128-bit (32-character hex) digest. It is fast and compact, but it is cryptographically broken — researchers demonstrated practical collision attacks in 2004, and in 2012 the Flame malware exploited an MD5 collision in Windows Update certificates. MD5 should never be used for security. It is still acceptable as a non-cryptographic checksum where collision resistance does not matter: verifying a download, deduplicating files, or building a cache key.

SHA-256 is part of the SHA-2 family, published by NIST in 2001. It produces a 256-bit (64-character hex) digest. No practical collision or preimage attacks exist. It is the default choice for anything security-related: certificate signatures (TLS certificates use SHA-256), blockchain proof of work (Bitcoin), git commit identifiers (since Git 2.29), content-addressable storage, and HMAC-based authentication such as the signatures in JWTs signed with HS256.

Hash Algorithm Comparison

AlgorithmDigest sizeHex charsStatusUse case
MD5128 bits32Broken — collisions practicalNon-security checksums only
SHA-1160 bits40Deprecated — collision demonstrated (SHAttered, 2017)Legacy systems, git (transitioning away)
SHA-256256 bits64SecureGeneral purpose, TLS, blockchain, HMAC
SHA-384384 bits96SecureTLS cipher suites requiring >256-bit security
SHA-512512 bits128SecureLarger margin, slightly faster on 64-bit CPUs

When to Use Each Algorithm

How Hashing Works, Step by Step

Every hash function follows the same pattern. The input is padded to a multiple of the block size (512 bits for SHA-256, 512 bits for MD5). Padding always includes a 1 bit, then zeros, then the original message length. The padded message is split into blocks, and each block is processed through a compression function that mixes it with the running state. The final state is the digest.

The compression function is where the algorithms diverge. MD5 uses four rounds of 16 operations each, with bitwise functions and precomputed sine-table constants. SHA-256 uses 64 rounds with a more complex mixing schedule and different constants derived from the first 64 primes. The additional rounds and wider state are what give SHA-256 its collision resistance.

How to Hash in Every Language

JavaScript / Node.js

// Browser (SHA-256)
const data = new TextEncoder().encode("hello");
const hash = await crypto.subtle.digest("SHA-256", data);
const hex = [...new Uint8Array(hash)]
  .map(b => b.toString(16).padStart(2, "0")).join("");

// Node.js
const { createHash } = require("crypto");
const hex = createHash("sha256").update("hello").digest("hex");

Python

import hashlib
hashlib.sha256(b"hello").hexdigest()
hashlib.md5(b"hello").hexdigest()

Java

import java.security.MessageDigest;
byte[] hash = MessageDigest.getInstance("SHA-256")
    .digest("hello".getBytes("UTF-8"));
StringBuilder sb = new StringBuilder();
for (byte b : hash) sb.append(String.format("%02x", b));

Bash / Command Line

# SHA-256
echo -n "hello" | sha256sum
# MD5
echo -n "hello" | md5sum
# File hash
sha256sum myfile.tar.gz

Go

import (
    "crypto/sha256"
    "fmt"
)
h := sha256.Sum256([]byte("hello"))
fmt.Printf("%x\n", h)

Verifying File Integrity with Checksums

When a project publishes a download alongside a .sha256 file, the workflow is straightforward. Download the file, hash it locally, and compare the digests. If they match, the file arrived intact. If they differ, the download was corrupted or tampered with.

# Download and verify
curl -O https://example.com/release.tar.gz
curl -O https://example.com/release.tar.gz.sha256
sha256sum -c release.tar.gz.sha256

This tool performs the same operation in your browser — drop the file onto the drop zone, select SHA-256, and compare the output to the published digest. Nothing is uploaded, so verifying a confidential binary does not leak it.

How to Check an MD5 or SHA-256 Checksum on Windows, macOS, and Linux

Every major operating system ships a checksum command, but each one names it differently and prints the digest in its own format. The digest itself is identical across all of them — only the presentation changes.

SystemSHA-256MD5Output format
Linuxsha256sum file.isomd5sum file.isoLowercase hex, then the filename
macOSshasum -a 256 file.isomd5 file.isoLowercase hex; md5 prints MD5 (file.iso) = …
Windows PowerShellGet-FileHash file.isoGet-FileHash file.iso -Algorithm MD5Uppercase hex in a table (SHA-256 is the default)
Windows Command Promptcertutil -hashfile file.iso SHA256certutil -hashfile file.iso MD5Hex digest on its own line, between a header and a status line

The most frequent false alarm is a case mismatch: PowerShell prints 2CF24DBA… while a project page publishes 2cf24dba…. Hex is case-insensitive, so those are the same digest. Tick Uppercase under the output above to match PowerShell, or leave it off to match Linux and macOS, and compare the full string rather than the first few characters — a tampered file only has to match the prefix you actually read.

If you cannot run a command at all — a locked-down work laptop, a Chromebook, a tablet — drop the file on this page instead. The browser reads it locally, and the SHA-256 you get is the same one sha256sum would print.

Common Hashing Mistakes

Hash Lengths at a Glance

The digest is always the same length regardless of input size. An empty string and a gigabyte file produce the same number of hex characters.

AlgorithmHex outputExample (hash of "hello")
MD532 chars5d41402abc4b2a76b9719d911017c592
SHA-140 charsaaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d
SHA-25664 chars2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824
SHA-38496 chars59e1748777448c69de6b800d7a33bbfb9ff1b463e44354c3553bcdb9c666fa90125a3c79f90397bdf5f6a13de828684f
SHA-512128 chars9b71d224bd62f3785d96d46ad3ea3d73319bfbc2890caadae2dff72519673ca72323c3d99ba5c11d7c7acc6e14b8c5da0c4663475c2e5c3adef46f73bcdec043

Hash Test Vectors: Is Your SHA-256 Output Correct?

When you write your own hashing code, the fastest sanity check is a known-answer test: hash a standard input and compare against the published digest. The strings abc and the pangram below are the classic vectors used in the SHA and MD5 specifications and in most library test suites. Each value here was produced by this tool and cross-checked against Node.js crypto.createHash.

InputAlgorithmDigest
abcSHA-256ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad
abcMD5900150983cd24fb0d6963f7d28e17f72
abcSHA-1a9993e364706816aba3e25717850c26c9cd0d89d
The quick brown fox jumps over the lazy dogSHA-256d7a8fbb307d7809469ca9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592
The quick brown fox jumps over the lazy dogMD59e107d9d372bb6826bd81d3542a419d6
The quick brown fox jumps over the lazy dog. (with a full stop)SHA-256ef537f25c895bfa782526529a9b63d97aa631564d5d789c2b765448c8635fb6c
The quick brown fox jumps over the lazy dog. (with a full stop)MD5e4d909c290d0fb1ca068ffaddf22cbd0

The last two rows are the avalanche effect in practice: adding one full stop changes every part of both digests. They also show why a test vector has to be byte-exact. The same logic explains the echo newline trap — hello with a trailing newline hashes to 5891b5b522d5df086d0ff0b110fbd9d21bb4fc7163af34d08286a2e846f6be03 under SHA-256, not the 2cf24dba… shown in the table above. Press Enter at the end of your text in the input box and you will see exactly that value.

If your implementation passes abc but fails longer inputs, suspect the padding step: inputs of 55, 56, and 64 bytes sit on the block boundaries where length-encoding bugs appear. Hash strings of those lengths here and diff them against your output.

Subresource Integrity (SRI)

When you load a script from a CDN, the CDN could theoretically serve malicious code. Subresource Integrity lets browsers verify a fetched resource against a hash you commit to in your HTML:

<script src="https://cdn.example.com/lib.js"
  integrity="sha384-oqVuAfXRKap7fdg..."
  crossorigin="anonymous"></script>

The browser hashes the downloaded file and refuses to execute it if the digest does not match. SRI uses SHA-256, SHA-384, or SHA-512 — never MD5 or SHA-1. The hash is Base64-encoded (not hex), so if you need to convert between formats, our Base64 encoder handles that.

Hashing in Cron Jobs and Automation

Scheduled scripts that fetch remote data often need to detect whether anything changed since the last run. Hashing the fetched content and comparing it to the stored hash from the previous run is cheaper and more reliable than tracking modification timestamps, which many APIs do not provide. If you are writing those schedules, our cron expression generator shows the next run times so you can verify the interval before deployment.

Frequently Asked Questions

Is my data sent to a server?
No. All hashing runs in your browser using the Web Crypto API (for SHA) and a pure JavaScript implementation (for MD5). Nothing is transmitted, logged, or stored.
Can I reverse a hash to get the original text?
No. A cryptographic hash is a one-way function. There is no mathematical inverse. The only way to find an input that produces a given hash is to try candidates until one matches — which is computationally infeasible for a strong hash like SHA-256 with sufficient input entropy.
Why is MD5 still offered if it is broken?
MD5 is broken for collision resistance, meaning an attacker can craft two different inputs with the same hash. It is still fine as a non-cryptographic checksum — verifying that a download was not corrupted in transit, deduplicating files, or building cache keys. It should never be used where an adversary controls the input.
Is SHA-256 the same as SHA-2?
SHA-2 is a family of algorithms: SHA-224, SHA-256, SHA-384, and SHA-512. SHA-256 is the most widely used member. When documentation says "SHA-2", it almost always means SHA-256 specifically.
Should I use SHA-256 to hash passwords?
No. SHA-256 is designed to be fast, which is exactly what you do not want for passwords. Use bcrypt, scrypt, or Argon2id — algorithms that are deliberately slow and memory-intensive to resist brute-force and GPU attacks.
Why does my hash differ from another tool's output?
Almost always an encoding difference. Check whether both tools encode the input as UTF-8 bytes before hashing, and whether the other tool appends a trailing newline (command-line echo without -n does). Case differences in the hex output (uppercase vs lowercase) do not mean the hashes differ — the underlying bytes are the same.
How do I check a SHA-256 checksum on Windows?
Open PowerShell and run Get-FileHash file.iso — SHA-256 is the default algorithm. From Command Prompt, certutil -hashfile file.iso SHA256 does the same. PowerShell prints uppercase hex; that matches a lowercase published checksum, because hex is case-insensitive. You can also drop the file on this page to get the digest without a terminal.
How do I generate an MD5 hash?
Select MD5 above and type your text or drop a file; the 32-character digest appears as you type. On the command line use md5sum on Linux, md5 on macOS, or Get-FileHash -Algorithm MD5 in Windows PowerShell. As a check, the MD5 of abc is 900150983cd24fb0d6963f7d28e17f72. Use MD5 only for non-security checksums.