Cron is the Unix/Linux task scheduler and the basis of cron jobs on servers, containers and cloud services. Its syntax looks cryptic at first (*/15 * * * *), but once you understand the five fields, it's very simple. This guide explains it with examples.
The five cron fields
A cron expression has five fields separated by spaces, each with a range:
* * * * *
│ │ │ │ │
│ │ │ │ └── Day of week (0-6, Sunday=0)
│ │ │ └──── Month (1-12)
│ │ └────── Day of month (1-31)
│ └──────── Hour (0-23)
└────────── Minute (0-59)
Each field says when the task runs. The task runs when all fields match the current time.
The symbols you need
*(asterisk): "every" value. In the minute field, it means every minute.,(list): several values.1,15,30= at minutes 1, 15 and 30.-(range): an interval.9-17in the hour = from 9 to 17./(step): every N.*/15in the minute = every 15 minutes.
Practical examples
| Expression | When it runs |
|---|---|
* * * * * |
Every minute |
*/15 * * * * |
Every 15 minutes |
0 * * * * |
Every hour on the hour |
0 9 * * * |
Every day at 9:00 |
0 9 * * 1 |
Every Monday at 9:00 |
0 0 1 * * |
The 1st of each month at midnight |
0 9-17 * * 1-5 |
Every hour, 9 to 17, Monday to Friday |
30 2 * * 0 |
Sundays at 2:30 |
Building and reading these expressions is much easier with a visual builder. You can do it free with the cron generator on this site, which translates the expression to plain language as you create it.
How to read an expression step by step
Take 0 9-17 * * 1-5:
- Minute
0: at minute 0. - Hour
9-17: from 9 to 17. - Day of month
*: any day. - Month
*: any month. - Day of week
1-5: Monday to Friday.
Result: every hour on the hour, 9:00 to 17:00, Monday to Friday. Useful for office tasks.
Common cron mistakes
- Confusing day of month and day of week: if you set both, in many implementations the task runs when either matches, not both. Watch out for that.
- Forgetting the time zone: cron uses the server's zone. A task "at 9" might be a different time for you.
- Overlapping tasks: if a task takes longer than its interval, two can run at once. Control concurrency.
- Sunday is 0 (and sometimes 7): depending on the system, Sunday can be 0 or 7.
Frequently asked questions
Is cron used outside Linux? Cron syntax is used in many systems: GitHub Actions, Kubernetes CronJobs, cloud services, Node libraries… The format is the same.
How do I run something every 30 seconds? Cron has minute resolution; for seconds you need another tool or two offset tasks.
What do @daily or @hourly mean? They're shortcuts: @daily = 0 0 * * *, @hourly = 0 * * * *.
Is my data uploaded? No, if you use a local generator. Everything happens in your browser.
Create and understand cron expressions instantly with the free cron generator, with plain-language translation and 100% in your browser.