> ## 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.

# LENGTH

> Returns the character count of a string or the byte count of binary data.

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

**Aliases:** [`len`](/query/sql/functions/string/len)

Returns NULL for NULL input.

## Syntax

### String or binary

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

### Alias: LEN (string only)

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

* LEN accepts STRING. Use LENGTH for BINARY values.

## Arguments

### String, len string

| Name | Type | Required | Description |
| - | - | - | - |
| value | STRING | Yes | The string to measure. |

### Binary

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

## Returns

* Type: INTEGER for ordinary STRING or BINARY input; BIGINT for strings using large-string storage
* Possible values: A nonnegative character or byte count.
* NULL behavior: Returns NULL for NULL input.

### Len string

* Type: INTEGER; BIGINT for strings using large-string storage
* Possible values: A nonnegative Unicode character count.
* NULL behavior: Returns NULL for NULL input.

## Properties

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

## Usage notes

* STRING counts Unicode code points; BINARY counts bytes.

## Examples

### Typical behavior

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT length('é') AS characters, length(X'C3A9') AS bytes;
```

| characters | bytes |
| - | - |
| 1 | 2 |

### Example values

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT len('é') AS characters, len(CAST(NULL AS STRING)) AS null_value;
```

| characters | null\_value |
| - | - |
| 1 | NULL |

## Limitations

* Large STRING or BINARY columns can return BIGINT counts. Other supported inputs return INTEGER. Query tools may report INTEGER even for a BIGINT result.
* LEN accepts STRING inputs. Use LENGTH for BINARY. Large-string columns can return BIGINT even when query tools report INTEGER.


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