About SHA-512 Hash
SHA-512 takes an input of any length and produces a fixed 512-bit digest, written as 128 hexadecimal characters. The same input always gives the same digest, a one-character change gives a completely different one, and there is no way to run the function backwards to recover the input.
Internally it processes the message in 1024-bit blocks using 64-bit words, after padding the message and appending its bit length. That padding step is why hashing an empty string still produces a full-length digest rather than nothing.
SHA-512 operates on 64-bit words and 1024-bit blocks, which makes it faster than SHA-256 on 64-bit hardware for anything but very short inputs, despite the longer digest.
A 512-bit digest is more than almost any application needs; the usual reasons to pick it are throughput on 64-bit CPUs and matching an existing spec. Like SHA-256, it is vulnerable to length extension - use HMAC rather than hash(secret + message).
SHA-512 is the throughput choice on 64-bit hardware and the basis of SHA-512/256 (a truncated variant that gets 64-bit speed with a 256-bit output). It is also what sha512crypt uses in /etc/shadow on most Linux distributions - which is a key derivation scheme with thousands of rounds, not a bare hash, and is not what this tool computes.
This page runs SHA-512 entirely in your browser through the Web Crypto API - the same implementation your browser uses for TLS. Nothing you paste is uploaded, logged, or leaves the tab, which matters when the thing you are hashing is a real token or customer record.
How to use the SHA-512 Hash
- Paste or type your input into the text box - any text, JSON, a token, or a whole file's contents.
- The 512-bit digest is computed as you type and shown as 128 lowercase hex characters.
- Use the copy button to take the digest, and compare it against the value you are checking against.
- Comparing two digests by eye is error-prone - paste both into the Text Diff tool if they are long, or compare the first and last eight characters at minimum.
Examples
-
Input
UUID Studio
SHA-512 Hash in code
The same operation this tool performs, in the languages you are most likely to need it.
const bytes = new TextEncoder().encode("hello world");
const digest = await crypto.subtle.digest("SHA-512", bytes);
const hex = [...new Uint8Array(digest)]
.map((b) => b.toString(16).padStart(2, "0"))
.join("");
console.log(hex); // 128 hex characters
import { createHash } from "node:crypto";
const hex = createHash("sha512").update("hello world").digest("hex");
console.log(hex);
// Large files: stream instead of buffering the whole thing
import { createReadStream } from "node:fs";
import { pipeline } from "node:stream/promises";
const hash = createHash("sha512");
await pipeline(createReadStream("big.tar.gz"), hash);
console.log(hash.digest("hex"));
import hashlib
print(hashlib.sha512(b"hello world").hexdigest())
# Large files: read in chunks so you don't load it all into memory
h = hashlib.sha512()
with open("big.tar.gz", "rb") as f:
for chunk in iter(lambda: f.read(1024 * 1024), b""):
h.update(chunk)
print(h.hexdigest())
import java.security.MessageDigest;
import java.nio.charset.StandardCharsets;
MessageDigest md = MessageDigest.getInstance("SHA-512");
byte[] digest = md.digest("hello world".getBytes(StandardCharsets.UTF_8));
StringBuilder sb = new StringBuilder();
for (byte b : digest) sb.append(String.format("%02x", b));
System.out.println(sb);
package main
import (
"crypto/sha512"
"encoding/hex"
"fmt"
)
func main() {
sum := sha512.Sum512([]byte("hello world"))
fmt.Println(hex.EncodeToString(sum[:]))
}
using System.Security.Cryptography;
using System.Text;
byte[] digest = SHA512.HashData(Encoding.UTF8.GetBytes("hello world"));
Console.WriteLine(Convert.ToHexString(digest).ToLowerInvariant());
# macOS / Linux
echo -n "hello world" | shasum -a 512 | cut -d" " -f1
# Note the -n: without it, echo appends a newline and you get a
# different digest than every other example on this page.
When you need this
- Hashing large files where 64-bit word size gives better throughput than SHA-256.
- Matching a digest from a specification that mandates 512 bits.
- Verifying a checksum published as SHA-512 alongside a release.
- Producing a long digest to truncate deliberately for a shorter identifier.
- Comparing SHA-512 and SHA-256 timings on your own hardware.
Common problems and what causes them
- Confusing SHA-512 with sha512crypt
- The $6$ hashes in /etc/shadow are sha512crypt - a key derivation scheme running thousands of rounds with a salt - not a single SHA-512. Hashing a password with plain SHA-512 will never reproduce them, and plain SHA-512 is not a password hash.
- Length extension on SHA-512
- Like SHA-256, SHA-512 is a Merkle-Damgard construction and is vulnerable to length extension, so sha512(secret + message) is not a MAC. SHA-384, being truncated, is not vulnerable - but the right answer is HMAC.
- Your digest doesn't match the other system's, for the same input
- Almost always a trailing newline or an encoding difference. `echo "x"` appends \n but `echo -n "x"` does not, and a file saved with CRLF line endings hashes differently from the same file with LF. Hash the exact bytes, not the visually identical text.
- Hex vs Base64 vs raw bytes
- The same 512-bit digest can be printed as 128 hex characters, as Base64, or stored as 64 raw bytes. A mismatch is often just two systems formatting the same digest differently - decode both to bytes before concluding they differ.
- Uppercase vs lowercase hex
- Hex digests are case-insensitive as values but not as strings. `A3F1` and `a3f1` are the same digest and different strings, so a naive `==` comparison fails. Normalise case before comparing.
- Using SHA-512 to hash passwords
- A fast hash is the wrong tool for passwords - commodity hardware computes billions per second, so a leaked table is brute-forced quickly. Use bcrypt, scrypt or Argon2, which are deliberately slow and salted.
- Comparing digests with a non-constant-time comparison
- When you are checking a digest that acts as a secret or a signature, an early-exit string compare leaks how many leading characters matched. Use a constant-time comparison (`crypto.timingSafeEqual`, `hmac.compare_digest`, `MessageDigest.isEqual`).
FAQ
- Is SHA-512 slower than SHA-256?
- Usually faster on 64-bit hardware, for anything but very short inputs. It uses 64-bit words and 1024-bit blocks, so it processes more data per round. On 32-bit platforms the reverse holds.
- What is SHA-512/256?
- SHA-512 truncated to 256 bits with different initial constants. It gets SHA-512 throughput on 64-bit hardware with a 256-bit output, and like SHA-384 it is immune to length extension. Support is less widespread than SHA-256, so check your platform.
- How long is a SHA-512 hash?
- Always 512 bits - 128 hexadecimal characters, or 64 bytes raw - no matter whether the input is one character or a gigabyte.
- Can a SHA-512 hash be decrypted or reversed?
- No. Hashing is not encryption; it discards information and has no key and no inverse. What people mean by "reversing" a hash is looking it up in a precomputed table of common inputs, which is why unsalted hashes of predictable values (short passwords, email addresses) are not private.
- Is SHA-512 safe to use in 2026?
- SHA-512 operates on 64-bit words and 1024-bit blocks, which makes it faster than SHA-256 on 64-bit hardware for anything but very short inputs, despite the longer digest.
- Why does the same text give a different hash elsewhere?
- Check for a trailing newline, CRLF vs LF line endings, a byte-order mark at the start of the file, or a different character encoding. All of those change the bytes without changing what you see on screen.
- Is this tool sending my input to a server?
- No. The digest is computed in your browser with the Web Crypto API. There is no upload, no request, and no logging - you can confirm it by opening your network tab, or by disconnecting from the network and using the tool offline.
- Should I use SHA-512 or HMAC-SHA-512?
- Use plain SHA-512 when you want an integrity check that anyone can recompute. Use HMAC-SHA-512 when the check has to prove the sender knew a shared secret - webhook signatures, API request signing, tamper-evident tokens. Never hand-roll that as hash(secret + message).