Skip to main content

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