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.

Try Hex in Calcul.io

Start with one of the editable examples above, then replace its arguments with your own values. Keeping the function on a separate calculator line makes the input and result easy to compare. For a longer workflow, assign the result to a variable or reference that line in the next expression.

Check the shown signature before adding optional arguments, and use the related-function links to compare operations with similar purposes.

All functions