---
schema_version: "1"
id: 073a200a7ac8bd0ed0d12f51eec7b28ffdcda586e8e9a70be48e7946053e0f67
title: OCTET_LENGTH
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/data-cloud/data-cloud-query-guide/references/data-cloud-sql-reference/scalar-func/string-func/octet-length.md
canonical_url: https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/octet-length.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 155a54857b5a52988667cd671e587f1b5c730fb9a15cf5eb04a5a1a77ecb99f9
products:
  - Data 360 Query Guide
  - Data 360 Developer Documentation
---
# `OCTET_LENGTH`

**Applies to:** ✅ Data 360 SQL ✅ Tableau Hyper API

Returns the number of bytes in a string.

## Syntax

```sql
octet_length(<string>)
```

## Arguments

### Required

- `<string>`: The string to measure.

## Returns

Returns an integer that represents the number of bytes in the string.

## Considerations

- For UTF-8 encoded strings, multi-byte characters contribute more than one byte each.
- This function differs from `char_length`, which counts characters.

## Examples

### Calculate Byte Length

Get the byte length of a string.

```sql
SELECT octet_length('jose') AS result;
```

Returns `4` (4 ASCII characters, 1 byte each).

## Related Documentation

- [String Types](https://developer.salesforce.com/docs/data/data-cloud-query-guide/datatype/string.md)
