Redis Command Generator
Generate redis-cli commands for strings, hashes, lists, sets, and sorted sets.
Written by Golam Rabbani, Founder & Lead Engineer
How to use this redis command generator
- Pick a Redis command: GET, SET, HSET, LPUSH, EXPIRE, ZADD, and more.
- Enter the key — any value containing spaces or quotes will be auto-quoted.
- Fill in the command-specific fields (value, seconds, field, range, or pair list).
- Press Generate to build a single-line redis-cli command.
- Use Copy to paste it into redis-cli or Reset to start over.
About this redis command generator
The Redis command generator covers sixteen everyday Redis commands across strings, hashes, lists, sets, sorted sets, and key expiry. Tokens that contain whitespace or a quote are wrapped in double quotes with internal backslashes and quotes escaped — matching how redis-cli parses commands. Integer-only fields (EXPIRE seconds, INCRBY delta, LRANGE/ZRANGE indices) and number-only fields (ZADD scores) are validated up-front so a bad value is caught before you paste the command anywhere.
Worked example: pick HSET, set key to "user:42", and pair list to "name=Ada Lovelace, [email protected]". Because "Ada Lovelace" contains a space, the value is quoted automatically. The tool emits: HSET user:42 name "Ada Lovelace" email [email protected]
Switch to SET with key "session:abc", value "token-xyz", and EX seconds = 60, and you get: SET session:abc token-xyz EX 60. For sorted sets, pick ZADD with key "leaderboard", and a pair list of "100=alice, 95=bob, 88=carol" — the tool validates each score is numeric, then emits ZADD leaderboard 100 alice 95 bob 88 carol in one shot. Everything runs in your browser, so even production keys stay private.
FAQ
- Which Redis commands are supported?
- GET, SET (with optional EX TTL), DEL, EXPIRE, TTL, INCR, INCRBY, LPUSH, RPUSH, LRANGE, HSET, HGET, SADD, SMEMBERS, ZADD, and ZRANGE — sixteen commands covering the most common CRUD operations across data structures.
- How are values with spaces or quotes handled?
- Tokens matching /\s|["\\]/ are wrapped in double quotes with internal backslashes and double quotes escaped. Tokens without those characters are emitted bare, matching what redis-cli accepts on the command line.
- Why does SET have an EX seconds field?
- SET supports an inline TTL via the EX option, so SET key value EX 60 stores the value with a 60-second expiry in a single round trip. Leave the field blank and no EX is appended.
- How do I add multiple list members or sorted-set entries?
- For LPUSH/RPUSH/SADD use a comma-separated list of values. For ZADD use a comma-separated list of score=member pairs — the generator splits, validates numeric scores, and emits them in the score-then-member order Redis expects.
- Does it run the command for me?
- No. The generator only builds the string. Run it yourself in redis-cli, RedisInsight, or any Redis client; that keeps your server credentials off the page.
- Is it safe to use with production data?
- Yes. All input stays in your browser. Nothing is logged, sent, or stored after the page closes.