{
  "schema_version": 2,
  "id": "commands/srem",
  "title": "SREM",
  "url": "https://redis.io/docs/latest/commands/srem/",
  "summary": "Removes one or more members from a set. Deletes the set if the last member was removed.",
  "since": "1.0.0",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-07-24T11:07:00+02:00",
  "page_type": "content",
  "content_hash": "1f9df15d2560b07c78f2437fb11e685d3ad0583187b91f89a8c3fb6269f0ddbe",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "Remove the specified members from the set stored at `key`.\nSpecified members that are not a member of this set are ignored.\nIf `key` does not exist, it is treated as an empty set and this command returns\n`0`.\n\nAn error is returned when the value stored at `key` is not a set."
    },
    {
      "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 set.\n\n</details>\n\n<details open><summary><code>member [member ...]</code></summary>\n\nOne or more members to remove from the set.\n\n</details>"
    },
    {
      "id": "examples",
      "title": "Examples",
      "role": "example",
      "text": "redis> SADD myset \"one\"\n(integer) 1\nredis> SADD myset \"two\"\n(integer) 1\nredis> SADD myset \"three\"\n(integer) 1\nredis> SREM myset \"one\"\n(integer) 1\nredis> SREM myset \"four\"\n(integer) 0\nredis> SMEMBERS myset\n1) \"two\"\n2) \"three\""
    },
    {
      "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 members that were removed from the set, not including non existing members.\n\n**RESP3:**\n\n[Integer reply](../../develop/reference/protocol-spec#integers): Number of members that were removed from the set, not including non existing members."
    }
  ],
  "examples": []
}
