{
  "id": "zdiff",
  "title": "ZDIFF",
  "url": "https://redis.io/docs/latest/commands/zdiff/",
  "summary": "Returns the difference between multiple sorted sets.",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-04-09T10:29:34-04:00",
  "page_type": "content",
  "content_hash": "60de4fd0b1f99774ea0216a092c2fc1c1db54825842fa25d4f43186a95e1fb6d",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "This command's behavior varies in clustered Redis environments. See the [multi-key operations]() page for more information.\n\n\n\nThis command is similar to [`ZDIFFSTORE`](), but instead of storing the resulting\nsorted set, it is returned to the client."
    },
    {
      "id": "examples",
      "title": "Examples",
      "role": "example",
      "text": "ZADD zset1 1 \"one\"\nZADD zset1 2 \"two\"\nZADD zset1 3 \"three\"\nZADD zset2 1 \"one\"\nZADD zset2 2 \"two\"\nZDIFF 2 zset1 zset2\nZDIFF 2 zset1 zset2 WITHSCORES"
    },
    {
      "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): the result of the difference including, optionally, scores when the _WITHSCORES_ option is used.\n\n**RESP3:**\n\n* [Array reply](../../develop/reference/protocol-spec#arrays): the result of the difference including, optionally, scores when the _WITHSCORES_ option is used."
    }
  ],
  "examples": []
}
