hex

hex(value)

Try it yourself:

See also:

Convert integers to hexadecimal with hex

hex(value) represents an integer in base 16. Hexadecimal uses digits 0–9 and letters A–F, and is common in programming, binary inspection, colors, and memory-oriented work.

Examples and related bases

Decimal 255 becomes FF in hexadecimal. Use bin for base 2 and oct for base 8. Bitwise operations such as bitAnd are often easier to understand when their results are displayed in hex.

Input notes

Hex is intended for integer values. Fractional input should be converted deliberately rather than assuming a meaningful digit-for-digit representation; use floor or round only when that rounding rule is truly intended. The result is a textual/base representation, not a new quantity to add directly without conversion.

All functions