Hex

Hashing & encoding

hex converter

Convert between hex, decimal and binary (any size, uint256 safe, signed two’s complement), and between UTF-8 text, hex bytes and bytes32 for Solidity.

runs in your browser
try
decimal
255
hex
0xff
binary
0b11111111
as a 32-byte word (uint256 / bytes32)
0x00000000000000000000000000000000000000000000000000000000000000ff

good to know

how do i turn a string into bytes32?

take its utf-8 bytes and right-pad with zeros to 32 bytes. it only fits if the string is 32 bytes or less; longer strings need bytes or string.

why is my negative number huge?

int256 values are stored as two’s complement: -1 is 0xff…ff. the signed view decodes that back into a negative number.