# LLEN

> Get the length of a list.

URL: https://docs.hotkv.com/commands/llen/

```
LLEN key
```

- Group: List
- Complexity: O(1)
- HotKV Cloud: all plans
- On-Premise: no license needed

`LLEN` returns the number of elements in the list stored at `key`.

## Return value

| Case | RESP2 | RESP3 |
| --- | --- | --- |
| List exists | Integer: the length | Same |
| Key does not exist | Integer `0` | Same |

`LLEN` replies with a `WRONGTYPE` error if `key` holds a value that is not a
list.

## Examples

```
127.0.0.1:6379> RPUSH queue a b c
(integer) 3
127.0.0.1:6379> LLEN queue
(integer) 3
127.0.0.1:6379> LLEN nosuchkey
(integer) 0
```

## Compatibility

Same as Redis 7.4 and Valkey 8.

## See also

[LRANGE](https://docs.hotkv.com/commands/lrange/index.md), [LINDEX](https://docs.hotkv.com/commands/lindex/index.md), [RPUSH](https://docs.hotkv.com/commands/rpush/index.md)