--- acl_categories: - '@read' - '@string' - '@fast' arguments: - display_text: key key_spec_index: 0 name: key type: key arity: 2 categories: - docs - develop - stack - oss - rs - rc - oss - kubernetes - clients command_flags: - readonly - fast complexity: O(1) description: Returns the string value of a key. group: string hidden: false key_specs: - RO: true access: true begin_search: spec: index: 1 type: index find_keys: spec: keystep: 1 lastkey: 0 limit: 0 type: range linkTitle: GET railroad_diagram: /images/railroad/get.svg since: 1.0.0 summary: Returns the string value of a key. syntax_fmt: GET key title: GET --- Get the value of `key`. If the key does not exist the special value `nil` is returned. An error is returned if the value stored at `key` is not a string, because `GET` only handles string values. ## Examples {{% redis-cli %}} GET nonexisting SET mykey "Hello" GET mykey {{% /redis-cli %}} ### Code examples {{< clients-example set="set_and_get" step="get" description="Foundational: Retrieve the string value of a key using GET (returns nil if key doesn't exist)" difficulty="beginner" />}} ## Redis Software and Redis Cloud compatibility | Redis
Software | Redis
Cloud | Notes | |:----------------------|:-----------------|:------| | ✅ Standard
✅ Active-Active | ✅ Standard
✅ Active-Active | | ## Return information {{< multitabs id="get-return-info" tab1="RESP2" tab2="RESP3" >}} One of the following: * [Bulk string reply](../../develop/reference/protocol-spec#bulk-strings): the value of the key. * [Nil reply](../../develop/reference/protocol-spec#bulk-strings): if the key does not exist. -tab-sep- One of the following: * [Bulk string reply](../../develop/reference/protocol-spec#bulk-strings): the value of the key. * [Null reply](../../develop/reference/protocol-spec#nulls): key does not exist. {{< /multitabs >}}