> ## Documentation Index
> Fetch the complete documentation index at: https://voltaire.tevm.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Hash String with Keccak256

> Hash a UTF-8 string using Keccak256 and get the result as hex

Hash a UTF-8 string using Keccak256 and get the result as hex

```typescript theme={null}
import { Keccak256 } from '@tevm/voltaire/Keccak256';
import { Hex } from '@tevm/voltaire/Hex';

// Hash a simple string
const message = "Hello, World!";
const hash = Keccak256(message);
const hexHash = Hex.fromBytes(hash);

// Hash an empty string
const emptyHash = Keccak256("");
const emptyHexHash = Hex.fromBytes(emptyHash);
```

> [!TIP]
>
> This is a fully executable example. View the complete source with test assertions at [`examples/hashing/keccak256-string.ts`](https://github.com/evmts/voltaire/blob/main/examples/hashing/keccak256-string.ts).

## Related

* [API Reference](https://voltaire.tevm.sh/primitives)
* [More Examples](https://voltaire.tevm.sh/examples)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.