# **CHAR_LENGTH()**

## **Function Description**

`CHAR_LENGTH` returns the length of the string `str` in characters, and a multibyte character is counted as one character. The length of the character corresponding to a Chinese character is 1.

## **Function Syntax**

```text
> CHAR_LENGTH(str)
```

## **Parameter definition**

| Parameters | Description |
| ---- | ---- |
| str | Required parameter, string to calculate length |

:::{note}
<font size=3>`CHAR_LENGTH` can also be written as `lengthUTF8()`. </font>
:::
## **Example**

```text
> drop table if exists t1;
> create table t1(a varchar(255),b varchar(255));
> insert into t1 values('nihao','Hello');
> select char_length(a), char_length(b) from t1;
+---------------------------------------+
| lengthutf8(a) | lengthutf8(b) |
+---------------------------------------+
| 5 | 2 |
+---------------------------------------+
```
