{
  "schema_version": 2,
  "id": "commands/bitfield_ro",
  "title": "BITFIELD_RO",
  "url": "https://redis.io/docs/latest/commands/bitfield_ro/",
  "summary": "Performs arbitrary read-only bitfield integer operations on strings.",
  "since": "6.0.0",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-09-18T16:45:12+01:00",
  "page_type": "content",
  "content_hash": "f71d80dd233db865de7414f04f121432d6754b1a5993fb27ab791bbc22d49fd3",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "Read-only variant of the [`BITFIELD`](https://redis.io/docs/latest/commands/bitfield) command.\nIt is like the original [`BITFIELD`](https://redis.io/docs/latest/commands/bitfield) but only accepts `GET` subcommand and can safely be used in read-only replicas.\n\nSince the original [`BITFIELD`](https://redis.io/docs/latest/commands/bitfield) has `SET` and `INCRBY` options it is technically flagged as a writing command in the Redis command table.\nFor this reason read-only replicas in a Redis Cluster will redirect it to the master instance even if the connection is in read-only mode (see the [`READONLY`](https://redis.io/docs/latest/commands/readonly) command of Redis Cluster).\n\nSince Redis 6.2, the `BITFIELD_RO` variant was introduced in order to allow [`BITFIELD`](https://redis.io/docs/latest/commands/bitfield) behavior in read-only replicas without breaking compatibility on command flags.\n\nSee original [`BITFIELD`](https://redis.io/docs/latest/commands/bitfield) for more details."
    },
    {
      "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>"
    },
    {
      "id": "optional-arguments",
      "title": "Optional arguments",
      "role": "parameters",
      "text": "<details open><summary><code>GET encoding offset</code></summary>\n\nReturn the value at `offset`, interpreted with `encoding` (for example `u8` or `i16`). May be given multiple times.\n\n</details>"
    },
    {
      "id": "examples",
      "title": "Examples",
      "role": "example",
      "text": "[code example]"
    },
    {
      "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\n[Array reply](../../develop/reference/protocol-spec#arrays): each entry being the corresponding result of the sub-command given at the same position.\n\n**RESP3:**\n\n[Array reply](../../develop/reference/protocol-spec#arrays): each entry being the corresponding result of the sub-command given at the same position."
    }
  ],
  "examples": [
    {
      "id": "examples-ex0",
      "language": "plaintext",
      "code": "BITFIELD_RO hello GET i8 16",
      "section_id": "examples"
    }
  ]
}
