# TAG.COUNT

> Return the number of tags attached to a key.

URL: https://docs.hotkv.com/commands/tag-count/

```
TAG.COUNT key
```

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

`TAG.COUNT` returns how many tags are attached to `key`.

## Return value

| Case | RESP2 | RESP3 |
| --- | --- | --- |
| Always | Integer: the number of tags (`0` when none, or no such key) | Integer |

## Examples

```
127.0.0.1:6379> SET article:1 "..."
OK
127.0.0.1:6379> TAG.SET article:1 news sports europe
(integer) 3
127.0.0.1:6379> TAG.COUNT article:1
(integer) 3
127.0.0.1:6379> TAG.COUNT article:2
(integer) 0
```

## Compatibility

HotKV-only command.

## See also

[TAG.GET](https://docs.hotkv.com/commands/tag-get/index.md), [TAG.SET](https://docs.hotkv.com/commands/tag-set/index.md), [TAG.EXISTS](https://docs.hotkv.com/commands/tag-exists/index.md)