---
hide_title: false
hide_table_of_contents: false
pagination_next: null
pagination_prev: null
---
# Math.clz32()

The **`Math.clz32()`** function returns the number of leading zero bits in the 32-bit binary representation of a number.

## Syntax

```js
Math.clz32(x)
```

### Parameters

- `x`
  - : A number.

### Return value

The number of leading zero bits in the 32-bit binary representation of `x`.

## Description

`clz32` is short for **C**ount**L**eading**Z**eros**32**.

If `x` is not a number, it will be converted to a number first, then converted to a 32-bit unsigned integer.

If the converted 32-bit unsigned integer is `0`, `32` is returned, because all bits are `0`. If the most significant bit is `1` (i.e. the number is greater than or equal to 2<sup>31</sup>), `0` is returned.

This function is particularly useful for systems that compile to JS, like [Emscripten](https://emscripten.org).
