---
layout: default
---
Function hex #
Format a number as hexadecimal.
Syntax #
```js
math.hex(value)
```
Parameters #
Parameter | Type | Description
--------- | ---- | -----------
`value` | number | BigNumber | Value to be stringified
`wordSize` | number | BigNumber | Optional word size (see `format`)
Returns #
Type | Description
---- | -----------
string | The formatted value
Throws #
Type | Description
---- | -----------
Examples #
```js
math.hex(240) // returns "0xf0"
```
See also #
[oct](oct.html),
[bin](bin.html)