HomeDeveloper ToolsHash Generator
🔐 Cryptographic Checksum Studio

SHA-256, SHA-512 & SHA-1 Hash Generator

Compute cryptographic hashes of text directly in your browser using the Web Crypto API.

SHA-256
SHA-512
SHA-1

What a cryptographic hash guarantees

A hash function turns input of any length into a fixed-length fingerprint called a digest. SHA-1, SHA-256 and SHA-512 are specified in the US standard FIPS 180-4 and produce 160, 256 and 512 bits, shown here as 40, 64 and 128 hexadecimal characters.

Good cryptographic hashes have three properties. The same input always gives the same digest. It is infeasible to work backwards from a digest to the input. And it is infeasible to find two different inputs with the same digest, which is called collision resistance. A tiny change to the input flips about half the output bits, so similar inputs give completely unrelated digests.

This generator encodes your text as UTF-8 and hashes it with the browser's Web Crypto API, showing all three digests at once.

Worked example: one character changes everything

The SHA-256 digest of hello is 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824. Capitalise the first letter and the digest of Hello becomes 185f8db32271fe25f561a6fc938b2e264306ec304eda518007d1764826381969, with no visible relationship to the first.

Add an invisible newline and hello followed by a line break hashes to 5891b5b522d5df086d0ff0b110fbd9d21bb4fc7163af34d08286a2e846f6be03. This is the most common reason a hash from the command line does not match one from code: echo hello | sha256sum includes the newline, while printf hello | sha256sum does not.

Choosing between SHA-1, SHA-256 and SHA-512

SHA-1 is broken for collision resistance. In 2017 researchers from CWI Amsterdam and Google published two different PDF files with the same SHA-1 digest. It is still seen in older systems and in Git object IDs, but it should not be used for signatures, certificates or anything an attacker could tamper with.

SHA-256 is the sensible default for integrity checks, content addressing and signatures. SHA-512 offers a larger margin and often runs faster than SHA-256 on 64-bit processors for large inputs, at the cost of a longer digest.

None of the three is suitable on its own for storing passwords, because they are designed to be fast, which makes guessing cheap. Use a dedicated password hashing function such as Argon2id, bcrypt, scrypt or PBKDF2, each of which adds a salt and a tunable work factor.

Practical uses and the limits of a text hasher

Hashing text is useful for comparing configuration values without revealing them, building cache keys, checking that a string survived a copy between systems, and debugging API signature schemes where you need to confirm the exact string being hashed.

This page hashes typed or pasted text, not files. To verify a downloaded installer or ISO against a published checksum, hash the file itself on your machine:

  • Linux: sha256sum filename
  • macOS: shasum -a 256 filename
  • Windows PowerShell: Get-FileHash filename -Algorithm SHA256
  • Windows Command Prompt: certutil -hashfile filename SHA256

Cryptographic Hash Generator: frequently asked questions

Can a SHA-256 hash be reversed to get the original text?

Not mathematically, but short or common inputs can be guessed. Attackers hash dictionaries of likely values and compare results, so the digest of a common password or a 10-digit phone number can be found quickly. Hashing does not hide low-entropy data.

Why does my program produce a different hash for the same text?

Check for a trailing newline or space, a different character encoding (UTF-16 instead of UTF-8), and Windows line endings (CRLF instead of LF). Also confirm both sides use the same output format, since some libraries return Base64 instead of hex, and hex may be upper or lower case.

Is hashing the same as encryption?

No. Encryption uses a key and is designed to be reversed by whoever holds that key. A hash has no key and is one-way, so it is used to verify data rather than to protect it for later reading.

What is HMAC and when do I need it instead of a plain hash?

HMAC combines a secret key with a hash function to prove a message came from someone who knows the key. Use it for webhook signatures and API request signing. Simply hashing secret plus message is unsafe with SHA-256 and SHA-512 because of length-extension attacks.

How long is a SHA-256 hash?

It is 256 bits, or 32 bytes. Written in hexadecimal that is 64 characters, and in Base64 it is 44 characters including one padding character.

All developer utilities & crypto