# EXISTS

> Count how many of the given keys exist.

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

```
EXISTS key [key ...]
```

- Group: Keys
- Complexity: O(N) for N keys
- HotKV Cloud: all plans
- On-Premise: no license needed

`EXISTS` tells you whether keys exist. With several keys it returns how many
of them exist, and a key named twice is counted twice. Checking a key does not
count as an access to it, so it does not change the key's idle time or access
frequency.

## Return value

| Case | RESP2 | RESP3 |
| --- | --- | --- |
| Always | Integer: the number of named keys that exist | Integer |

## Examples

```
127.0.0.1:6379> SET user:1 "ada"
OK
127.0.0.1:6379> EXISTS user:1
(integer) 1
127.0.0.1:6379> EXISTS user:1 user:1 user:2
(integer) 2
```

## Compatibility

Same as Redis 7 and Valkey 8.

## See also

[TOUCH](https://docs.hotkv.com/commands/touch/index.md), [TYPE](https://docs.hotkv.com/commands/type/index.md), [DEL](https://docs.hotkv.com/commands/del/index.md),
[SCAN](https://docs.hotkv.com/commands/scan/index.md)