What Is a Cron Expression?
A cron expression is a string of five (or six) fields that defines a schedule for recurring tasks. Originally from Unix, cron is now used across Linux servers, CI/CD pipelines, cloud functions, and task schedulers everywhere.
The Five-Field Format
┌───────── minute (0-59)
│ ┌─────── hour (0-23)
│ │ ┌───── day of month (1-31)
│ │ │ ┌─── month (1-12)
│ │ │ │ ┌─ day of week (0-7, 0 and 7 = Sunday)
│ │ │ │ │
* * * * *
Special Characters
| Char | Meaning | Example |
|---|---|---|
* | Every value | * * * * * = every minute |
, | List | 1,15 * * * * = minute 1 and 15 |
- | Range | 9-17 * * * * = hours 9 through 17 |
/ | Step | */15 * * * * = every 15 minutes |
Common Patterns
| Expression | Schedule |
|---|---|
* * * * * | Every minute |
0 * * * * | Every hour (at :00) |
0 0 * * * | Daily at midnight |
0 0 * * 1 | Every Monday at midnight |
0 0 1 * * | 1st of every month |
*/15 * * * * | Every 15 minutes |
0 9-17 * * 1-5 | Weekdays, 9am–5pm, hourly |
0 0 1 1 * | Yearly - January 1st at midnight |
30 4 * * * | Daily at 4:30 AM |
0 */2 * * * | Every 2 hours |
Real-World Use Cases
Database Backups
0 2 * * * /usr/local/bin/backup-db.sh
Run a database backup every day at 2:00 AM.
Log Rotation
0 0 * * 0 /usr/sbin/logrotate /etc/logrotate.conf
Rotate logs every Sunday at midnight.
Cache Clearing
*/30 * * * * curl -X POST https://api.example.com/cache/clear
Clear cache every 30 minutes.
SSL Certificate Renewal
0 3 1 * * certbot renew --quiet
Attempt certificate renewal on the 1st of every month at 3:00 AM.
Common Mistakes
- Forgetting the month/day-of-week fields - all five fields are required
- Confusing day-of-week numbering - 0 and 7 both mean Sunday (system-dependent)
- Setting both day-of-month AND day-of-week - this creates an OR condition, not AND
- Not accounting for timezone - cron typically runs in the server's local timezone
- Overlapping executions - if a job takes 5 minutes but runs every minute, you'll have 5 concurrent instances
Build Your Own
Use our Cron Expression Generator to build and validate cron expressions with an interactive visual builder - see the next 10 execution times instantly.

