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

# OCTET_LENGTH

> Counts the bytes in a string or binary value.

<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"}}
octet_length(value)
```

## Arguments

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

## Returns

* Type: INT
* Possible values: A nonnegative byte count; zero for an empty value.
* NULL behavior: Returns NULL for NULL input.

## Properties

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

## Units

* Input unit: UTF-8 string or bytes
* Output unit: Bytes
* character\_length counts Unicode code points.

## Examples

### Typical behavior

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT octet_length('josé') AS bytes, octet_length(X'00FF') AS binary_bytes;
```

| bytes | binary\_bytes |
| - | - |
| 5 | 2 |

### Text bytes versus binary bytes

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT octet_length('é猫') AS text_bytes, octet_length(X'C3A9') AS binary_bytes;
```

| text\_bytes | binary\_bytes |
| - | - |
| 5 | 2 |


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