> ## Documentation Index
> Fetch the complete documentation index at: https://docs.e6data.com/llms.txt
> Use this file to discover all available pages before exploring further.

# BITMAP_COUNT

> Counts the set bits in binary bitmap data.

<div className="e6-meta"><span className="e6-eyebrow e6-eyebrow--quiet">Scalar function</span></div>

Returns NULL for NULL input.

## Syntax

### Scalar

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
bitmap_count(value)
```

## Arguments

| Name | Type | Required | Description |
| - | - | - | - |
| value | BINARY | Yes | The bitmap bytes. |

## Returns

* Type: BIGINT
* Possible values: The total population count across every byte; zero for an empty bitmap.
* NULL behavior: Returns NULL for NULL input.

## Properties

| Property | Value |
| - | - |
| Deterministic | Yes |
| Supports window usage | No |
| Exact result | Yes |

## Examples

### Typical behavior

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT bitmap_count(X'0F00FF') AS bits, bitmap_count(X'') AS empty_bitmap;
```

| bits | empty\_bitmap |
| - | - |
| 12 | 0 |

### Count set bits rather than bytes

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT bitmap_count(X'0000') AS all_zero_bits, bitmap_count(X'FFFF') AS all_one_bits;
```

| all\_zero\_bits | all\_one\_bits |
| - | - |
| 0 | 16 |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.