﻿---
title: ES|QL LENGTH function
description: 
url: https://www.elastic.co/elastic/docs-builder/docs/3028/reference/query-languages/esql/functions-operators/string-functions/length
products:
  - Elasticsearch
---

# ES|QL LENGTH function
## Syntax

![Embedded](https://www.elastic.co/elastic/docs-builder/docs/3028/reference/query-languages/esql/images/functions/length.svg)


## Parameters

<definitions>
  <definition term="string">
    String expression. If `null`, the function returns `null`.
  </definition>
</definitions>


## Description

Returns the character length of a string.
<note>
  All strings are in UTF-8, so a single character can use multiple bytes.
</note>


## Supported types


| string  | result  |
|---------|---------|
| keyword | integer |
| text    | integer |


## Example

```esql
FROM airports
| WHERE country == "India"
| KEEP city
| EVAL fn_length = LENGTH(city)
```


| city:keyword | fn_length:integer |
|--------------|-------------------|
| Agwār        | 5                 |
| Ahmedabad    | 9                 |
| Bangalore    | 9                 |