{
  "id": "getbit",
  "title": "GETBIT",
  "url": "https://redis.io/docs/latest/commands/getbit/",
  "summary": "Returns a bit value by offset.",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-07-02T11:31:07-05:00",
  "page_type": "content",
  "content_hash": "6394bf30f23657a927aa8c12f3879294df566359268fa7e2974e8feb6c6a4801",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "Returns the bit value at _offset_ in the string value stored at _key_.\n\nWhen _offset_ is beyond the string length, the string is assumed to be a\ncontiguous space with 0 bits.\nWhen _key_ does not exist it is assumed to be an empty string, so _offset_ is\nalways out of range and the value is also assumed to be a contiguous space with\n0 bits."
    },
    {
      "id": "required-arguments",
      "title": "Required arguments",
      "role": "content",
      "text": "<details open><summary><code>key</code></summary>\n\nThe name of the key that holds the string.\n\n</details>\n\n<details open><summary><code>offset</code></summary>\n\nThe zero-based bit offset to read.\n\n</details>"
    },
    {
      "id": "examples",
      "title": "Examples",
      "role": "example",
      "text": "SETBIT mykey 7 1\nGETBIT mykey 0\nGETBIT mykey 7\nGETBIT mykey 100"
    },
    {
      "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; Standard</span><br /><span title=\"Supported\"><nobr>&#x2705; Active-Active</nobr></span> | <span title=\"Supported\">&#x2705; Standard</span><br /><span title=\"Supported\"><nobr>&#x2705; Active-Active</nobr></span> |  |"
    },
    {
      "id": "return-information",
      "title": "Return information",
      "role": "returns",
      "text": "**RESP2:**\n\nThe bit value stored at _offset_, one of the following:\n* [Integer reply](../../develop/reference/protocol-spec#integers): `0`.\n* [Integer reply](../../develop/reference/protocol-spec#integers): `1`.\n\n**RESP3:**\n\nThe bit value stored at _offset_, one of the following:\n* [Integer reply](../../develop/reference/protocol-spec#integers): `0`.\n* [Integer reply](../../develop/reference/protocol-spec#integers): `1`."
    }
  ],
  "examples": []
}
