Skip to contentSkip to the inputSkip to the result

SHA-256 hash

Compute the SHA-256 digest of text or a file.

Loading tool

Instructions

SHA-256 hash

How to use

  1. Enter text or choose a file and generate its hexadecimal digest.

Supported input

  • SHA-256, SHA-1, SHA-384, SHA-512, MD5 and CRC-32 for text or files up to 100 MB, as hex, Base64 or SRI.
  • A hash cannot be reversed.

Input example

hello

Result example

2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824

Troubleshooting

  • Check required inputs, numeric ranges and the selected conversion direction.

How it works

  • Compute the SHA-256 digest of text or a file.

Checking a SHA-256 checksum, and why the same text can hash differently

What people use it for

  • Confirming that a downloaded installer or ISO matches the SHA-256 value the publisher lists
  • Writing the integrity attribute (Subresource Integrity) for a script or stylesheet loaded from a CDN
  • Telling whether two config files or two pieces of text are identical without reading them side by side
  • Naming things by their content, as cache keys or when hunting for duplicate files

What SHA-256 actually does

As FIPS 180-4 defines it, SHA-256 appends a single 1 bit, enough zeros and the original length as a 64-bit number, so the message fills whole 512-bit blocks. Each block is then mixed into eight 32-bit working values over 64 rounds, and the final eight values side by side are the 256-bit digest. The same input always gives the same digest; flip one bit and the result looks unrelated.

You can check the arithmetic against the standard's own examples. "abc" gives ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad, empty input gives e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855, and the 56-character abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq gives 248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1. The tool produces all three exactly as NIST publishes them.

Worked example: an SRI value for a script

  1. 1An SRI value is not hex: it is the digest bytes in Base64, prefixed with the algorithm name. Set Style to SRI (sha384-…) and the tool writes it in that form.
  2. 2For a file whose content is abc, SHA-384 gives sha384-ywB1P0WjXou1oD1pmsZQBycsMqsO3tFjGotgWkP/W+2AhgcroefMI1i67KE0yCWn and SHA-256 gives sha256-ungWv48Bz+pBQUDeXa4iI7ADYaOWF3qctBD/YfIAFa0=.
  3. 3For a real script, use the Hash a file button rather than pasting its text. If pasting changes a single line ending, the digest no longer matches what the browser downloads, and the browser blocks the script.
  4. 4A file from another origin also needs crossorigin="anonymous" on the tag, or the browser cannot check it. The tool refuses to make SRI values from MD5 or CRC-32.

Same-looking text, different bytes

A hash is computed over bytes, not over what you see. café with é as one character (U+00E9) is 5 bytes in UTF-8 and hashes to 850f7dc4…; written as e plus a combining accent (U+0301) it is 6 bytes and hashes to 81ef060b…. The decomposed form turns up in text copied from macOS file names, among other places.

Line endings matter just as much: a and b separated by LF hash to 7e18f737…, separated by Windows CRLF to 18745f36…. Git's line-ending conversion or an editor setting can give one file two different digests, so verify files as files. The comparison box ignores surrounding spaces and the case of hex digits, so a checksum the publisher printed in capitals can be pasted as it is.

Matching the command line

  • macOS: shasum -a 256 filename
  • Linux: sha256sum filename, or sha256sum -c SHA256SUMS to check every file in a publisher's checksum list at once
  • Windows: certutil -hashfile filename SHA256, or Get-FileHash filename in PowerShell, which defaults to SHA256 and prints upper case
  • If the tool and the command line disagree on the same file, the usual cause is that they were given different files, or the download had not finished.

Choosing an algorithm, and what is not here

  • SHA-1: NIST has told users to move off it by 31 December 2030. Use it only to compare against an old site that publishes nothing else.
  • MD5 and CRC-32: neither resists a deliberately crafted collision. CRC-32 is for catching accidental corruption; its standard check input 123456789 gives CBF43926, a quick way to confirm an implementation.
  • No HMAC. Signing an API request with HMAC-SHA256 mixes in a secret key, so its value never matches a plain hash of the same message, and this tool has no key field.

Checked

Frequently asked questions

How long is a SHA-256 hash?

256 bits, shown as 64 hex characters. The other options are SHA-1 (40), SHA-384 (96), SHA-512 (128), and MD5 (32) and CRC-32 (8), which many download pages still publish. Output can also be upper case, Base64, or the SRI form (sha384-…) used in <script integrity>.

Why does my hash differ from another tool's?

A single trailing line break changes the whole result: 'hello' starts 2cf24dba…, but with a line break at the end it starts 5891b5b5…. This tool hashes the UTF-8 bytes, so tools using another encoding also differ.

Can I reverse a hash or use it to store passwords?

A hash is one-way, so the original cannot be recovered. Storing passwords needs a dedicated function such as bcrypt or Argon2 rather than a single SHA-256. Use MD5 and SHA-1 only to check files.