{
  "id": "bf.card",
  "title": "BF.CARD",
  "url": "https://redis.io/docs/latest/commands/bf.card/",
  "summary": "Returns the cardinality of a Bloom filter",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-04-09T10:29:34-04:00",
  "page_type": "content",
  "content_hash": "1d656e16227c2a167bdab5dca0e191c5fbe1898ec4a00ca0b60c8c46e08f7efe",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "Returns the cardinality of a Bloom filter - number of items that were added to a Bloom filter and detected as unique (items that caused at least one bit to be set in at least one sub-filter)\n\n(since RedisBloom 2.4.4)"
    },
    {
      "id": "required-arguments",
      "title": "Required arguments",
      "role": "content",
      "text": "<details open><summary><code>key</code></summary>\n\nis key name for a Bloom filter.\n\n</details>"
    },
    {
      "id": "examples",
      "title": "Examples",
      "role": "example",
      "text": "redis> BF.ADD bf1 item_foo\n(integer) 1\nredis> BF.CARD bf1\n(integer) 1\nredis> BF.CARD bf_new\n(integer) 0"
    },
    {
      "id": "redis-software-and-redis-cloud-compatibility",
      "title": "Redis Software and Redis Cloud compatibility",
      "role": "content",
      "text": "| Redis<br />Software | Redis<br />Cloud | <span style=\"min-width: 9em; display: table-cell\">Notes</span> |\n|:----------------------|:-----------------|:------|\n| <span title=\"Supported\">&#x2705; Supported</span><br /> | <span title=\"Supported\"><nobr>&#x2705; Flexible & Annual</nobr></span><br /><span title=\"Supported\">&#x2705; Free & Fixed</nobr></span> |  |"
    },
    {
      "id": "return-information",
      "title": "Return information",
      "role": "returns",
      "text": "**RESP2:**\n\nOne of the following:\n* [Integer reply](): the number of items detected as unique that were added to the Bloom filter (items that caused at least one bit to be set in at least one sub-filter), or `0` when the given `key` does not exist.\n* [Simple error reply]() in these cases: invalid arguments, wrong key type, or when the filter is full.\n\nNote: when `key` exists, `BF.CARD` returns the same value as `BF.INFO key ITEMS`.\n\n**RESP3:**\n\nOne of the following:\n* [Integer reply](): the number of items detected as unique that were added to the Bloom filter (items that caused at least one bit to be set in at least one sub-filter), or `0` when the given `key` does not exist.\n* [Simple error reply]() in these cases: invalid arguments, wrong key type, or when the filter is full.\n\nNote: when `key` exists, `BF.CARD` returns the same value as `BF.INFO key ITEMS`."
    }
  ],
  "examples": []
}
