{
  "schema_version": 2,
  "id": "commands/zrangestore",
  "title": "ZRANGESTORE",
  "url": "https://redis.io/docs/latest/commands/zrangestore/",
  "summary": "Stores a range of members from sorted set in a key.",
  "since": "6.2.0",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-09-18T09:48:43+01:00",
  "page_type": "content",
  "content_hash": "5105f7b4db24e922e82a4834adb80a16c7d9dd9ec1f13f1a2715ef1402e441c4",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "> [!NOTE]\n> This command's behavior varies in clustered Redis environments. See the [multi-key operations](https://redis.io/docs/latest/develop/using-commands/multi-key-operations) page for more information.\n\n\nThis command is like [`ZRANGE`](https://redis.io/docs/latest/commands/zrange), but stores the result in the `<dst>` destination key."
    },
    {
      "id": "required-arguments",
      "title": "Required arguments",
      "role": "content",
      "text": "<details open><summary><code>dst</code></summary>\n\nThe key to store the resulting sorted set in.\n\n</details>\n\n<details open><summary><code>src</code></summary>\n\nThe source sorted-set key.\n\n</details>\n\n<details open><summary><code>min</code></summary>\n\nThe start of the range. By default a zero-based index (negatives count from the end); a score bound with `BYSCORE`; or a lexicographical bound with `BYLEX`.\n\n</details>\n\n<details open><summary><code>max</code></summary>\n\nThe end of the range, inclusive. Interpreted the same way as `min`.\n\n</details>"
    },
    {
      "id": "optional-arguments",
      "title": "Optional arguments",
      "role": "parameters",
      "text": "<details open><summary><code>BYSCORE | BYLEX</code></summary>\n\nInterpret the range as a score range (`BYSCORE`) or a lexicographical range (`BYLEX`) instead of an index range.\n\n</details>\n\n<details open><summary><code>REV</code></summary>\n\nReverse the ordering so results are returned from high to low.\n\n</details>\n\n<details open><summary><code>LIMIT offset count</code></summary>\n\nSkip `offset` matching members and return up to `count` of them. Requires `BYSCORE` or `BYLEX`. A negative `count` returns all remaining members.\n\n</details>"
    },
    {
      "id": "examples",
      "title": "Examples",
      "role": "example",
      "text": "redis> ZADD srczset 1 \"one\" 2 \"two\" 3 \"three\" 4 \"four\"\n(integer) 4\nredis> ZRANGESTORE dstzset srczset 2 -1\n(integer) 2\nredis> ZRANGE dstzset 0 -1\n1) \"three\"\n2) \"four\""
    },
    {
      "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[Integer reply](../../develop/reference/protocol-spec#integers): the number of elements in the resulting sorted set.\n\n**RESP3:**\n\n[Integer reply](../../develop/reference/protocol-spec#integers): the number of elements in the resulting sorted set."
    }
  ],
  "examples": []
}
