--- acl_categories: - '@read' - '@hash' - '@fast' arguments: - display_text: key key_spec_index: 0 name: key type: key - display_text: field name: field type: string arity: 3 categories: - docs - develop - stack - oss - rs - rc - oss - kubernetes - clients command_flags: - readonly - fast complexity: O(1) description: Returns the length of the value of a field. group: hash hidden: false key_specs: - RO: true begin_search: spec: index: 1 type: index find_keys: spec: keystep: 1 lastkey: 0 limit: 0 type: range linkTitle: HSTRLEN railroad_diagram: /images/railroad/hstrlen.svg since: 3.2.0 summary: Returns the length of the value of a field. syntax_fmt: HSTRLEN key field title: HSTRLEN --- Returns the string length of the value associated with `field` in the hash stored at `key`. If the `key` or the `field` do not exist, 0 is returned. ## Examples {{% redis-cli %}} HSET myhash f1 HelloWorld f2 99 f3 -256 HSTRLEN myhash f1 HSTRLEN myhash f2 HSTRLEN myhash f3 {{% /redis-cli %}} ## Redis Software and Redis Cloud compatibility | Redis
Software | Redis
Cloud | Notes | |:----------------------|:-----------------|:------| | ✅ Standard
✅ Active-Active | ✅ Standard
✅ Active-Active | | ## Return information {{< multitabs id="hstrlen-return-info" tab1="RESP2" tab2="RESP3" >}} [Integer reply](../../develop/reference/protocol-spec#integers): the string length of the value associated with the _field_, or zero when the _field_ isn't present in the hash or the _key_ doesn't exist at all. -tab-sep- [Integer reply](../../develop/reference/protocol-spec#integers): the string length of the value associated with the _field_, or zero when the _field_ isn't present in the hash or the _key_ doesn't exist at all. {{< /multitabs >}}