Try it Live
Run Uint examples in the interactive playground
Big-Endian Byte Order
Uint256 uses big-endian (network byte order): most significant byte first.Examples
Length Handling
Variable Length (1-32 bytes)
Leading Zeros
Input is zero-padded on the left to 32 bytes internally:Converting from Primitives
From Address (20 bytes)
From Hash (32 bytes)
From Bytecode
Zero-Copy Performance
fromBytes is zero-copy when possible:
Usage Patterns
Binary Conversion
Slice of Larger Array
Reading Binary Data
See Also
- toBytes - Convert to byte array
- fromAbiEncoded - From ABI-encoded (strict 32 bytes)
- fromHex - From hex string

