AnyHash
Skip to content

SHA-256 Hash Generator

Compute a secure hash of any text or file using your browser's native Web Crypto API — fast, hardware-accelerated, and without a single byte leaving your device.

Or drop a file to verify its integrity hash

Drag & drop · up to 64 MB · solved locally

SHA-256 hash

 

Type or paste input to see its hash instantly.

Code snippets

Generate SHA-256 in your language

import { createHash } from "node:crypto";

console.log(createHash("sha256").update("hello world").digest("hex"));
// b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9

SHA-256 is built into every language's standard library — no third-party packages are needed. The hex digest is always 64 lowercase characters.

How SHA-256 works

SHA-256 breaks input into 512-bit blocks and runs 64 rounds of a compression function on a rotating 256-bit state, producing a fixed 256-bit digest. It is part of the SHA-2 family along with SHA-384 and SHA-512.

Because the Web Crypto API powers this page, hashing is hardware-accelerated and completely local — a 100 MB file digests in a fraction of a second on a modern machine.

What to use it for

  • Verifying downloaded software against its published checksum
  • Detecting accidental corruption or tampering in transferred files
  • Hashing API keys and tokens before storing them in a database
  • Integrating with tools that emit sha256sum-compatible digests

Storing passwords? SHA-256 is far too fast. Use bcrypt or Argon2id instead.

Algorithm guide

SHA-256 explained

What is SHA-256?

SHA-256 is a cryptographic hash function designed by the United States National Security Agency (NSA) and published in 2001 as part of FIPS PUB 180-2, the Federal Information Processing Standard for secure hashing. The "256" in its name refers to the length of the output: a fixed 256-bit digest, written as sixty-four hexadecimal characters.

Like every hash function, SHA-256 takes an input of any length — a single character or a multi-gigabyte file — and reduces it to a compact fingerprint. Change even one bit of the input and the resulting digest changes entirely, in a pattern that cannot be predicted or reversed. That avalanche effect, combined with the extreme difficulty of finding two different inputs with the same digest, makes SHA-256 the standard choice for file integrity, digital signatures, certificate authorities, and countless other protocols where the question is "was this tampered with?"

Where MD5 and SHA-1 fell to advances in cryptanalysis, SHA-256 has remained standing for over two decades. It is the conservative default recommended by NIST, OWASP, and every major software distribution platform as of 2026.

How SHA-256 works, step by step

SHA-256 is a Merkle–Damgård construction: a message schedule feeds into a compression function whose output becomes the chaining value for the next block. The process has four distinct phases.

1. Padding the message

The input is padded to a length that is congruent to 448 bits modulo 512, using a single 1 bit followed by zeros, and finally a 64-bit big-endian integer giving the original message length. This ensures every message boundary lands on a block boundary, with room left for the length field.

2. Message schedule

Each 512-bit block is split into sixteen 32-bit words. An algorithm expands these sixteen words into a schedule of sixty-four words by XORing and rotating earlier values. The message schedule is what gives SHA-256 its diffusion — each of the sixty-four rounds of the compression function uses a different word from the schedule, mixing influence from every part of the input into the final output.

3. Compression function

The working state of SHA-256 is eight 32-bit variables, initialized to the fractional parts of the square roots of the first eight primes — constants chosen not for any magical property but because their arbitrary starting values make the construction impossible to exploit algebraically. For each of sixty-four rounds, two auxiliary functions (Ch, Maj, Σ, σ) mix the message schedule word with the eight working variables and a round constant derived from the fractional parts of the cube roots of the first sixty-four primes. The computational cost is deliberate: SHA-256 is fast enough for high-throughput integrity checks but hard to parallelize inside a password-hashing scheme, a property that passwords need but checksums do not.

4. Producing the digest

After all blocks have been processed, the eight working variables are appended — in big-endian order, unlike MD5's little-endian convention — to form the final 256-bit digest. That digest is the sixty-four hex characters this page returns.

Security properties that SHA-256 still holds

A hash function is defined by three security goals. SHA-256 meets all three in practice:

  • Preimage resistance: Given a digest d, it should be computationally infeasible to find any input m such that SHA-256(m) = d. The theoretical best attack is brute-force search, which costs roughly 2256 operations — a number far beyond any physical computing system.
  • Second-preimage resistance: Given a specific input m₁, it should be computationally infeasible to find a different input m₂ with the same digest. The best known attack costs approximately 2256 operations.
  • Collision resistance: It should be computationally infeasible to find any two distinct inputs with the same digest. By the birthday bound, finding a collision costs roughly 2128 operations — immense, but about half the cost of a preimage attack. No collision attack against SHA-256 is known.

This stands in contrast to MD5 (broken collision resistance since 2004) and SHA-1 (practical collisions demonstrated in 2017 via the SHAttered attack, followed by chosen-prefix attacks). SHA-256's resistance is what made it the preferred hash for all security-sensitive applications in 2026.

The SHA-2 family: SHA-256, SHA-384, and SHA-512

SHA-256 is part of a family of hash functions introduced together in FIPS 180-2. The family shares a design philosophy — the same Merkle–Damgård structure, the same general mixing approach — but differs in word size, number of rounds, and output length:

SHA-1SHA-256SHA-384SHA-512
Digest160 bits256 bits384 bits512 bits
Block size512 bits512 bits1024 bits1024 bits
Word size32 bits32 bits64 bits64 bits
Rounds80648080
Collision statusBroken (2017)No attack (2026)No attack (2026)No attack (2026)
Best forLegacy onlyGeneral integrityHigh-security / 64-bit platformsHigh throughput, 64-bit

SHA-384 is a truncated variant of SHA-512 with different initial values. It exists for systems that need a hash output longer than 256 bits without switching to the heavier SHA-512 block schedule. In practice, SHA-256 handles most use cases — its 256-bit output offers a birthday collision bound of roughly 2128, which is more than sufficient for every protocol currently deployed.

Real-world use cases for SHA-256

SHA-256 is a general-purpose workhorse. Its most common deployments:

  • File and software integrity. Linux distributions, package managers, browser extensions, and open-source projects publish SHA-256 digests alongside every release. Users compare the published digest with a locally computed one to confirm the file was not tampered with in transit — exactly what this page's tool automates.
  • TLS certificates and digital signatures. Certificate authorities sign TLS certificates with SHA-256, and browsers verify those signatures on every HTTPS connection. If a TLS certificate's SHA-256 digest is forged, the browser refuses the connection.
  • Git and version control. Git uses SHA-1 (moving to SHA-256 for new repositories) to identify every commit, tree, and blob. Every commit hash is effectively a SHA digest of its contents, which makes the entire Git history a tamper-evident chain.
  • Blockchain and cryptocurrency. Bitcoin double-SHA-256 is used both in mining (the proof-of-work puzzle) and in transaction identification. The algorithm's hardness and determinism are precisely why Satoshi chose it.
  • HMAC-based key derivation and authentication. HMAC-SHA-256 generates authentication tags, derives sub-keys, and signs messages across APIs, JWT tokens, and AWS signatures.

Why SHA-256 is not a password hash

SHA-256 is fast by design, and that speed is a liability for password storage. A modern GPU computes tens of billions of SHA-256 hashes per second. For a database containing 10 million unsalted SHA-256 hashes, an attacker can exhaust the entire keyspace in minutes.

Adding a per-user salt prevents rainbow-table attacks but does not solve the throughput problem: salted SHA-256 is still billions of guesses per second on commodity hardware. Password hashing requires algorithms designed to be slow — with high memory costs, deliberate computational friction, and a tunable cost factor. bcrypt and Argon2id are the current standards for that job.

The mnemonic: SHA-256 for integrity, a password KDF for secrets. A hash function whose speed makes file verification instant is exactly the wrong tool when the attacker's advantage is guessing speed.

How the AnyHash SHA-256 tool works

  • Web Crypto API, native hardware acceleration. The digest is computed via crypto.subtle.digest("SHA-256", bytes) — a single call inside your browser that benefits from AES-NI and other CPU-level instructions on supported hardware. No JavaScript implementation is needed; the browser ships it.
  • Variant selector. The dropdown lets you switch between SHA-1, SHA-256, SHA-384, and SHA-512 with a keystroke. Each change re-hashes the same input against the selected algorithm immediately.
  • Input encodings. UTF-8 text, raw hex bytes, and Base64 are supported. When the input is hex, the page hashes the literal bytes instead of the characters a through f — useful when reproducing a checksum of binary data.
  • File hashing. Drop a file onto the tool or use the file picker: files up to 64 MB are read into memory as a Uint8Array and digested in one call. The status line reports the byte size, timing, and hex output, so you can verify with the same values below.
  • Zero uploads. Your input never leaves the browser. Open DevTools → Network and watch: the only network requests are the page, its CSS, and its fonts.

Worked examples you can verify

Paste each string into the tool with SHA-256 selected and you will get exactly these digests. All three are published reference vectors, verified against the FIPS 180-2 test suite:

InputSHA-256 digest
(empty string)e3b0c44298fc1c149afbf4c8996fb924
27ae41e4649b934ca495991b7852b855
abcba7816bf8f01cfea414140de5dae2223
b00361a396177a9cb410ff61f20015ad
The quick brown fox jumps over the lazy dogd7a8fbb307d7809469ca9abcb0082e4f
8d5651e46d3cdb762d02d0bf37c9e592

The empty-string test is particularly useful: SHA-256 hashes a zero-byte input to a completely deterministic digest. If your implementation produces the first value above for an empty textarea, the byte-level semantics are correct — the hash function received exactly zero bytes of input.

How to verify a SHA-256 checksum

  1. Obtain the published SHA-256 digest from the vendor's website, release notes, or signed checksum file.
  2. Drop the downloaded file onto this page, or run sha256sum filename (Linux/macOS) or CertUtil -hashfile filename SHA256 (Windows).
  3. Compare the two digests character by character. Any difference at all means the file does not match what the vendor intended to distribute.

For release-critical software, the strongest practice is to verify a signed GPG or minisig file rather than a bare digest — a bare SHA-256 value is only trustworthy if the source that published it is trustworthy. But in the common case — "did this file copy cleanly?" — SHA-256 is both the current standard and a strong answer.

The building blocks in depth

Underneath every SHA-256 implementation sits a small number of highly structured pieces. Understanding them helps demystify the language used in standards and papers.

  • Bits, bytes, words. SHA-256 operates entirely on 32-bit unsigned integers ("words"). Every intermediate value — message words, hash state components, constants — fits in 32 bits. The message is processed as 512-bit blocks, each containing sixteen 32-bit words, which are then expanded to sixty-four words using a deterministic schedule. The hash state has eight 32-bit words, which is why the final digest is exactly 256 bits.
  • Big-endian vs little-endian. The SHA-2 family uses big-endian byte order: the most significant byte comes first. A common source of debugging confusion: the Python standard library, OpenSSL, and Java all produce big-endian hex by convention; a raw memcpy from uint32_t on a little-endian CPU (x86, most ARM) produces the opposite, and the digest looks wrong. Every correct implementation handles this conversion, which is why byte-level access from crypto.subtle.digest always looks correct — the API handles endianness.
  • Message schedule. The 64-round compression function does not operate on the original sixteen message words alone: it expands them. Every round t (for t = 0 to 63) consumes a new 32-bit word derived by mixing words t − 2, t − 7, t − 15, and t − 16 through rotations, shifts, and XOR. The sixty-fourth word used by the last round is thus a function of the entire message block — a kind of diffusion that the compression function exploits.
  • Round constants (K). Each of the sixty-four rounds uses a unique 32-bit constant derived from the fractional parts of the cube roots of the first sixty-four primes — a way to inject non-linearity without hardcoding arbitrary values. The constants were published in FIPS 180-4 and are the same across every SHA-256 implementation.

The net effect: every message block produces a slightly different state update, and the final hash is that state concatenated and printed as 64 hexadecimal characters. There is no secret, no key, and no choice — SHA-256 is a pure function.

How real software uses SHA-256

SHA-256 does not just sit in cryptographic libraries — it shows up in places where its properties are taken for granted. Three examples worth knowing:

  • Git. Every object in Git (commit, tree, blob, tag) is addressed by SHA-1 or SHA-256, depending on the repository's hash-function configuration. The hash is computed over the object's content and header: blob 123\0file contentSHA-256(...). A change to a single character in a tracked file produces a new SHA-256 hash, which is why Git's internal graph is essentially a hash chain of content.
  • TLS and HTTPS. When your browser fetches this page, TLS negotiates a session that uses SHA-256 for HMAC-based PRF (pseudo-random function) and for certificate fingerprinting. The browser compares a SHA-256 fingerprint of the server's certificate against a list of known CAs — this is the "certificate check" that the padlock icon represents. A real change to the server's certificate changes its SHA-256 fingerprint, which is what makes misissuance detectable.
  • Cryptocurrency. Bitcoin uses SHA-256 twice (double SHA-256) for its proof-of-work mining and for transaction hashing. A new block's hash is a SHA-256 digest of the previous block's hash plus the new block's contents; finding a hash below a target requires trying trillions of nonces, which is the economic engine behind the network.

These examples share a single idea: SHA-256 is deterministic, publicly auditable, and produces outputs that are practically impossible to forge or predict — properties that make it suitable as the "fingerprint" layer of any system that needs to answer "has anything changed?".

Frequently asked questions

What is a SHA-256 hash?

SHA-256 is a one-way cryptographic hash function from the SHA-2 family. It takes any input and produces a fixed 256-bit (64 hex character) digest. It is widely used for file integrity, software distribution, TLS certificates, and blockchain applications.

Is SHA-256 secure?

Yes. SHA-256 has no known practical collisions or preimage attacks and is considered cryptographically secure. Unlike MD5 and SHA-1, it has not been broken, and it is the conservative default for integrity verification in 2026.

Can SHA-256 hashes be reversed?

No. Hashing is one-way. You cannot recover the original input from a SHA-256 digest. The only practical attack is brute-force guessing, which is why SHA-256 is used for integrity, not for storing passwords.

Why does hashing happen in my browser?

AnyHash uses your browser's native Web Crypto API. The digest is computed locally with hardware-accelerated cryptography, so your input — source code, documents, API keys — never travels to a remote server.

What is the difference between SHA-256 and bcrypt/Argon2id?

SHA-256 is a fast digest optimized for integrity checks. bcrypt and Argon2id are deliberately slow, salted key-derivation functions built for password storage. Use SHA-256 for files and data; use a password KDF for passwords.

Other hash tools