{
  "schema_version": 2,
  "id": "commands/mset",
  "title": "MSET",
  "url": "https://redis.io/docs/latest/commands/mset/",
  "summary": "Atomically creates or modifies the string values of one or more keys.",
  "since": "1.0.1",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-09-18T16:45:12+01:00",
  "page_type": "content",
  "content_hash": "3a919c87e6e254a6a3089ebc928cf5c832f5909a28c0c18ba72220c74d35ebde",
  "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\nSets the given keys to their respective values.\n`MSET` replaces existing values with new values, just as regular [`SET`](https://redis.io/docs/latest/commands/set).\nSee [`MSETNX`](https://redis.io/docs/latest/commands/msetnx) if you don't want to overwrite existing values.\n\n`MSET` is atomic, so all given keys are set at once.\nIt is not possible for clients to see that some of the keys were updated while\nothers are unchanged."
    },
    {
      "id": "required-arguments",
      "title": "Required arguments",
      "role": "content",
      "text": "<details open><summary><code>key value [key value ...]</code></summary>\n\nOne or more key-value pairs to set.\n\n</details>"
    },
    {
      "id": "examples",
      "title": "Examples",
      "role": "example",
      "text": "redis> MSET key1 \"Hello\" key2 \"World\"\nOK\nredis> GET key1\n\"Hello\"\nredis> GET key2\n\"World\""
    },
    {
      "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[Simple string reply](../../develop/reference/protocol-spec#simple-strings): always `OK` because `MSET` can't fail.\n\n**RESP3:**\n\n[Simple string reply](../../develop/reference/protocol-spec#simple-strings): always `OK` because `MSET` can't fail."
    }
  ],
  "examples": []
}
