Format Code Now
/

SHA-2 Hash Generator

HG-29

Paste text and pick a SHA-2 variant to get its hash as hex or Base64. One button shows all six variants side by side.

Runs in your browser. Nothing is uploaded.

Text (hashed as UTF-8)

SHA-2 hash

How to use it

  1. Type or paste your text into the input box. Sample loads the quick brown fox sentence.
  2. Pick the variant in the select: SHA-224, SHA-256, SHA-384, SHA-512, SHA-512/224 or SHA-512/256.
  3. Press Hash for one variant, or All six variants to compare them.
  4. Choose lowercase hex, UPPERCASE hex or Base64 for the output.
  5. Copy the result, or download it as a .txt file.

The six SHA-2 hashes

SHA-2 is the family in FIPS 180-4. SHA-256 and SHA-224 work on 32-bit words; SHA-512, SHA-384, SHA-512/256 and SHA-512/224 work on 64-bit words. The number after the name is the output length in bits: 224 bits is 56 hex characters, 256 is 64, 384 is 96 and 512 is 128. SHA-512/256 and SHA-512/224 run the SHA-512 steps from their own starting values, so they are not simply the front of a SHA-512 hash.

What runs where

SHA-256, SHA-384 and SHA-512 are computed by your browser's built-in Web Crypto. SHA-224, SHA-512/224 and SHA-512/256 are not offered there, so this page carries its own code for them and checks it against published test values. All variants are fast general-purpose hashes: do not store passwords with them alone. The text is hashed as UTF-8 exactly as typed, so a trailing line break changes the result.

Questions people ask

What is SHA-2?

SHA-2 is a family of six cryptographic hash functions defined in FIPS 180-4: SHA-224, SHA-256, SHA-384, SHA-512, SHA-512/224 and SHA-512/256. They turn any text into a fixed-length fingerprint, and the same input always gives the same output.

How do I generate a SHA-2 hash?

Type or paste your text, pick a variant from the select and press Hash. The result appears in hex or Base64. If you are not sure which variant you need, press All six variants to see every one at once.

Which SHA-2 variant should I use?

SHA-256 is the most common default. Use whichever length a specification or system names. SHA-384 and SHA-512 give longer output, and SHA-512/256 gives a 256-bit result computed on 64-bit words, which can be quicker on 64-bit machines.

Is SHA-512/256 the same as SHA-512 truncated?

No. SHA-512/256 starts from different initial values, so its output is not the first 256 bits of a SHA-512 hash of the same text. The two look unrelated.

Is SHA-2 the same as SHA-256?

SHA-256 is one member of SHA-2. People often say SHA-2 when they mean SHA-256, but the family also includes 224, 384, 512 and the two truncated 512 variants, all selectable here.

Can I hash a file with this tool?

No. It hashes text as typed or opened, encoded as UTF-8. A file saved with different line endings or an encoding other than UTF-8 would give a different hash than the same words typed here.

About this tool

SHA-2 is a family of six hashes from FIPS 180-4: SHA-224, SHA-256, SHA-384, SHA-512, SHA-512/224 and SHA-512/256. SHA-256, SHA-384 and SHA-512 run on your browser's built-in Web Crypto. SHA-224, SHA-512/224 and SHA-512/256 are written out in this page's own code and checked against published test values. The two truncated SHA-512 variants are not just SHA-512 cut short: they start from different values, so their output differs from the first bytes of a SHA-512 hash. The text is hashed exactly as typed, as UTF-8 (a lone surrogate half becomes U+FFFD first), so a trailing line break or a space changes the result; "Ignore one trailing line break" removes one. It hashes text, not files.

Format Code Now: free, no ads, no accounts. Your input stays in your browser.