Hash Generator
Generate SHA-1, SHA-256, SHA-384, and SHA-512 cryptographic hashes from any text. Runs entirely in your browser.
What is a Cryptographic Hash?
A cryptographic hash function takes any input — a word, a document, a file — and produces a fixed-length string of characters called a digest or hash. Hash functions have two key properties: they are deterministic (the same input always produces the same output) and one-way (it is computationally infeasible to reverse the hash to find the original input). Even a tiny change in the input — flipping a single bit — produces a completely different hash, a property called the avalanche effect. This makes hashes useful for verifying data integrity, storing passwords securely, and creating digital signatures.
Hash Algorithms Compared
- MD5 — Produces a 128-bit (32-character hex) hash. Fast but cryptographically broken — collisions (two different inputs producing the same hash) can be generated intentionally. Do not use MD5 for security purposes. Still useful for non-security checksums and legacy systems.
- SHA-1 — Produces a 160-bit (40-character hex) hash. Also considered cryptographically weak — practical collision attacks exist. Deprecated for TLS certificates and digital signatures. Avoid for new security applications.
- SHA-256 — Part of the SHA-2 family. Produces a 256-bit (64-character hex) hash. Currently considered secure for all practical purposes. The standard algorithm for password hashing (via bcrypt/PBKDF2), TLS certificates, code signing, and blockchain applications.
- SHA-512 — Also part of SHA-2. Produces a 512-bit (128-character hex) hash. More resistant to brute-force attacks on 64-bit hardware due to its internal 64-bit operations. Use when maximum security margin is required.
Common Use Cases for Hash Functions
- Password storage — Never store plain-text passwords. Store the hash so that even if the database is breached, passwords cannot be directly recovered.
- File integrity verification — Provide a SHA-256 hash alongside a download so users can verify the downloaded file was not corrupted or tampered with.
- Data deduplication — Hash file contents to detect duplicate files without comparing byte-by-byte.
- Digital signatures — Sign the hash of a document rather than the document itself to create tamper-evident signatures.
- Caching and ETags — HTTP ETags often use content hashes so clients can verify whether a resource has changed since it was last fetched.
How to Generate a SHA-256 Hash
- Type or paste the text you want to hash into the input box above.
- The SHA-256 digest — along with MD5, SHA-1, and SHA-512 — is computed instantly as you type.
- Click the SHA-256 value to copy it. To verify a file download, compare this digest against the checksum the publisher provides.
Hashing is deterministic, so the same input always yields the same digest. That is what lets you confirm a file hasn't changed: matching hashes mean identical content, and a single altered byte produces a completely different result.
Frequently Asked Questions
Can a hash be reversed to get the original text?
Not directly. Hash functions are one-way by design — there is no algorithm to reverse a hash to its input. However, an attacker can try to crack a hash by computing hashes for millions of common inputs (a dictionary attack or rainbow table attack) and checking for a match. This is why passwords should always be salted (a unique random value added before hashing) before being hashed with a slow algorithm like bcrypt.
Is my text sent to a server when I generate a hash?
No. This tool uses the Web Crypto API which runs entirely in your browser. Your input text is never transmitted anywhere. This makes it safe to hash sensitive data like passwords or API keys for verification purposes.
What is the difference between hashing and encryption?
Encryption is a reversible two-way process — data is transformed with a key and can be decrypted back to its original form with the right key. Hashing is a one-way process — data is transformed into a fixed digest that cannot be reversed. Use encryption when you need to retrieve the original data later; use hashing when you only need to verify that the data matches a stored value.
Why does SHA-256 produce the same hash every time for the same input?
This determinism is a fundamental property of hash functions — it is what makes them useful for verification. If you hash a file and get a certain SHA-256 digest, anyone else hashing the identical file will get exactly the same digest. This lets you confirm that two copies of a file are identical without transmitting the file itself, or verify that a file has not been modified since its hash was published.
Which hash algorithm should I use?
Use SHA-256 for anything security-related — checksums, signatures, integrity checks. SHA-512 offers a larger margin and can be faster on 64-bit hardware. Avoid MD5 and SHA-1 for security; they are broken by collision attacks, though MD5 is still fine as a non-security checksum for detecting accidental corruption.
Should I use this to hash passwords for storage?
Not directly. A raw SHA-256 is too fast for password storage — attackers can test billions of guesses per second. Real password storage uses a slow, salted algorithm such as bcrypt, scrypt, or Argon2. This tool is ideal for checksums and learning, not for hashing production passwords.