{
  "schema_version": 2,
  "id": "commands/randomkey",
  "title": "RANDOMKEY",
  "url": "https://redis.io/docs/latest/commands/randomkey/",
  "summary": "Returns a random key name from the database.",
  "since": "1.0.0",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-01-30T12:29:26-06:00",
  "page_type": "content",
  "content_hash": "e06c1c464d2e5d326beadc6ba66b21c7e0dea64fee4defc832b1bf2cfb4a4980",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "Return a random key from the currently selected database."
    },
    {
      "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\nOne of the following:\n* [Nil reply](../../develop/reference/protocol-spec#bulk-strings): when the database is empty.\n* [Bulk string reply](../../develop/reference/protocol-spec#bulk-strings): a random key in database.\n\n**RESP3:**\n\nOne of the following:\n* [Null reply](../../develop/reference/protocol-spec#nulls): when the database is empty.\n* [Bulk string reply](../../develop/reference/protocol-spec#bulk-strings): a random key in the database."
    }
  ],
  "examples": []
}
