String to Bytes32 Converter

Convert strings to bytes32 format for Solidity smart contracts. Perfect for working with fixed-size byte arrays in Ethereum development.

Live

Input String

Length: 0 / 31 characters

About Bytes32

bytes32 is a fixed-size byte array type in Solidity that holds exactly 32 bytes (256 bits) of data. It's commonly used for storing hashes, identifiers, and short strings in smart contracts.

Common Uses

  • Function identifiers
  • Storage keys
  • Role identifiers (AccessControl)
  • Short string storage

Characteristics

  • Fixed 32-byte size
  • Gas efficient storage
  • Max 31 UTF-8 characters
  • Hex representation

Example

Input:hello
Output:0x68656c6c6f000000000000000000000000000000000000000000000000000000

Solidity Usage:

bytes32 myBytes = 0x68656c6c6f00...;
// Convert string to bytes32
bytes32 converted = bytes32(abi.encodePacked("hello"));

Important Note

bytes32 can only hold up to 31 UTF-8 characters (one byte reserved for null terminator). For longer strings, use the dynamic 'bytes' or 'string' type in Solidity.