Redis TTL Converter
Convert TTL values between time units and generate Redis EXPIRE commands. Calculate expiration timestamps instantly.
Client-side only — nothing leaves your browser
Time Conversions
Seconds
3,600
Minutes
60
Hours
1
Days
0.04
Human Readable
1h
Unix Timestamp
1775308664
Expires At
4/4/2026, 8:17:44 PM
Redis Commands
Set TTL on existing key
EXPIRE mykey 3600Set TTL as timestamp
EXPIREAT mykey 1775308664Set TTL in milliseconds
PEXPIRE mykey 3600000Create key with TTL
SET mykey "value" EX 3600Understanding Redis TTL
TTL (Time To Live) determines how long a Redis key exists before automatic deletion. Use EXPIRE for relative durations (seconds from now) or EXPIREAT for absolute timestamps. Redis handles expiration efficiently with lazy and active deletion.
Command Reference
- EXPIRE — Set TTL in seconds (relative)
- EXPIREAT — Set expiry as Unix timestamp (absolute)
- PEXPIRE — Set TTL in milliseconds
- TTL / PTTL — Check remaining time
- PERSIST — Remove expiration
Common TTL Values
| Duration | Seconds | Use Case |
|---|---|---|
| 5 minutes | 300 | Rate limiting, OTP codes |
| 15 minutes | 900 | Session refresh tokens |
| 1 hour | 3600 | Cache, JWT access tokens |
| 24 hours | 86400 | Daily limits, feature flags |
| 7 days | 604800 | Session data, refresh tokens |
| 30 days | 2592000 | Remember me, long-term cache |
Frequently Asked Questions
What is TTL in Redis?
TTL (Time To Live) is the remaining lifetime of a key in seconds. When TTL reaches 0, Redis automatically deletes the key. Use the TTL command to check remaining time, EXPIRE to set TTL in seconds, or EXPIREAT to set an absolute Unix timestamp.
Is Redis TTL in seconds or milliseconds?
By default, Redis TTL is in seconds. The TTL command returns remaining time in seconds, and EXPIRE sets expiry in seconds. For millisecond precision, use PTTL and PEXPIRE instead. Most applications use second-precision TTL unless sub-second accuracy is needed for rate limiting or distributed locks.
What is the difference between EXPIRE and EXPIREAT?
EXPIRE sets TTL as a relative duration (e.g., EXPIRE key 3600 = expire in 1 hour). EXPIREAT sets an absolute Unix timestamp (e.g., EXPIREAT key 1704067200 = expire at that exact moment). Use EXPIRE for durations, EXPIREAT for specific times.
How do I remove TTL from a Redis key?
Use PERSIST key to remove the expiration and make a key permanent. After PERSIST, the key will no longer expire automatically. You can also re-set the key with SET without EX/PX options to remove expiry.
What does TTL return -1 or -2 mean?
TTL returns -1 if the key exists but has no expiry (persistent key). TTL returns -2 if the key doesn't exist. A positive number is the remaining seconds until expiration. Use EXISTS to check if a key exists before checking TTL.
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