Format Code Now
/
Hash & generateKeccak-256 Hash Generator Next: MD4 Hash Generator ›

Keccak-256 Hash Generator

HG-14

Paste text, or hex bytes with the hex option on, to get its Keccak-256 hash. This is the original Keccak that Ethereum uses, not the SHA3-256 standard.

Runs in your browser. Nothing is uploaded.

Text (hashed as UTF-8)

Keccak-256 hash

How to use it

  1. Type or paste text into the input box. Sample loads the quick brown fox sentence.
  2. To hash raw bytes instead, tick Input is hex bytes and paste hex such as 0xdeadbeef.
  3. The Keccak-256 hash appears as you type. Choose lowercase hex, UPPERCASE hex or Base64.
  4. Copy the result, or download it as a .txt file.

Keccak-256 and SHA3-256 differ

Keccak won the NIST competition, and NIST then changed the padding when it standardized SHA-3 in FIPS 202. Ethereum adopted Keccak earlier and kept the original. The two functions share the same permutation and differ only in the padding byte: 0x01 for Keccak-256, 0x06 for SHA3-256. Every input therefore gives a different hash. The empty string gives c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 here.

Text mode and hex mode

By default the box is text, encoded as UTF-8, which matches hashing a string in Solidity or ethers. Solidity often hashes bytes instead, for example a function signature or a packed value. Tick Input is hex bytes to read the box as hex bytes: spaces and a leading 0x are ignored, and an odd number of digits is an error. The hash of the text transfer(address,uint256) starts with a9059cbb, the well-known function selector.

What it does not do

This page computes the hash only. It does not apply the EIP-55 address checksum casing, ABI encoding or packing of values, or derive an address from a key. If a Solidity expression packs several values, hash the exact packed bytes in hex mode. The code is written out on the page and checked against Keccak test values; nothing is uploaded.

Error messages and what to do

MessageWhat it meansFix
The input is not valid hex: use only 0-9 and a-f (spaces and a leading 0x are ignored).The hex option is on, and the box holds a character that is not a hex digit.Remove the stray characters, or untick Input is hex bytes to hash the box as plain text.
The input is not valid hex: it has an odd number of digits.The hex option is on and the digits do not pair up into whole bytes.Add the missing digit, for example 0x0a instead of 0xa.

Questions people ask

How do I compute keccak256 of a string?

Type or paste the string into the box. Keccak-256 is computed as UTF-8 text and appears straight away. Choose hex or Base64, then copy it. Ethereum tools normally show it as lowercase hex with a 0x prefix, which you can add yourself.

How do I hash hex bytes like 0x1234?

Tick Input is hex bytes and paste the bytes. Spaces and a leading 0x are ignored. The hash is then taken over the decoded bytes, not over the characters of the hex text, which is the usual meaning when a contract hashes bytes.

Why is Keccak-256 different from SHA3-256?

The padding byte differs. The original Keccak appends 0x01 and the NIST SHA-3 standard appends 0x06. The same permutation then yields different results for every input, including the empty string.

What is the Keccak-256 hash of an empty string?

It is c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470. Leave the box empty to see it. Ethereum uses this value as the hash of empty code, so it shows up often in block explorers.

Does this match Solidity keccak256?

For plain text and for raw bytes in hex mode, yes: Solidity keccak256 hashes the bytes it is given. For abi.encodePacked or abi.encode results you must first produce those exact bytes yourself and paste them as hex.

Is Keccak-256 used outside Ethereum?

Yes, some other blockchains and tools use it, but the name alone does not guarantee the same padding. Check that a system means original Keccak, not SHA-3. If values do not match, try SHA3-256 on the other page.

About this tool

This is the original Keccak-256 that Ethereum and Solidity's keccak256 use. It differs from the SHA3-256 standard only in the padding byte (0x01 here, 0x06 in SHA3-256), so the two give different values for the same input: the empty string gives c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 here. With "Input is hex bytes" ticked, the box is read as raw bytes written in hex (spaces and a leading 0x are ignored), which is how a hash of binary data is usually written; otherwise the text is hashed as UTF-8. It does not apply any Ethereum address checksum casing or ABI encoding. 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: a file saved with different line endings would give a different hash than the same words typed here.

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