Redis Escape & Unescape

Escape special characters for Redis CLI, connection strings, and glob patterns. Handle quotes, spaces, and wildcards safely.

Client-side only — nothing leaves your browser

Escape for use in redis-cli double-quoted strings

Result will appear here...

CLI Escaping

For redis-cli double-quoted strings. Escapes quotes, backslashes, and control characters.

SET key "Hello \"World\""

URL Encoding

For passwords in connection strings. Encodes @, #, /, and other special chars.

redis://:p%40ss@host

Glob Escaping

For literal matching in KEYS/SCAN. Escapes *, ?, [, ] wildcards.

KEYS "user\*data"

Common Examples

OriginalEscaped (CLI)Usage
Hello "World"Hello \"World\"Double quotes in value
C:\path\fileC:\\path\\fileWindows paths
Line1 Line2Line1\nLine2Multiline text
p@ssw0rd#123p%40ssw0rd%23123Password (URL encoded)
user*user\*Literal asterisk (glob)
data[0]data\[0\]Array notation (glob)

Frequently Asked Questions

What characters need to be escaped in Redis?
It depends on the context. In redis-cli double-quoted strings, escape double quotes (\"), backslashes (\\), and control characters (\n, \r, \t). In connection string URLs, encode @, #, :, and / using percent-encoding (%40, %23, %3A, %2F). In KEYS/SCAN glob patterns, escape *, ?, [, and ] with backslash for literal matching. Client libraries handle RESP protocol escaping automatically.
Can Redis keys contain special characters?
Yes, Redis keys are binary safe and can contain any bytes, including spaces, newlines, and null bytes. However, for maintainability, avoid very long keys (>1KB) and prefer readable patterns like user:1234:profile. The colon (:) is a common namespace separator.
How do I escape special characters in RediSearch queries?
RediSearch uses its own query syntax where characters like @, !, {, }, (, ), -, ~, and * have special meaning. Escape them with a backslash: FT.SEARCH idx "hello\-world". For exact phrases, wrap in double quotes. Note that RediSearch escaping is different from redis-cli escaping - RediSearch operates at the query parser level, not the protocol level.
How do I escape a password with special characters in Redis?
In redis-cli, use: redis-cli -a 'password@with#special' (single quotes protect most characters). In connection strings, URL-encode special characters: @ becomes %40, # becomes %23, : becomes %3A. Our connection string generator handles this automatically.
How do I escape quotes in Redis strings?
In redis-cli with double-quoted strings, escape double quotes with backslash: SET key "value with \"quotes\"". Single quotes don't need escaping inside double quotes. In most programming languages, the Redis client library handles escaping automatically.
Redis

Need a Redis GUI Client?

1bench is a modern database client for Redis and 20+ other databases. Query, browse, and manage your data visually.

Learn More