Cron Syntax Reference
A standard cron expression has five space-separated fields that describe when a job runs. Each field accepts a value, a list, a range, or a step.
Fields (left to right)
| Field | Allowed values |
|---|---|
| Minute | 0–59 |
| Hour | 0–23 |
| Day of month | 1–31 |
| Month | 1–12 (or JAN–DEC) |
| Day of week | 0–7 (0 and 7 are Sunday, or SUN–SAT) |
Standard crontab has exactly these five fields. Some schedulers (node-cron, Spring, Quartz) take a sixth field for seconds (0-59) in front of the minute field.
Special characters
| Character | Meaning |
|---|---|
| * | Every value in the field |
| , | A list, e.g. 1,15,30 |
| - | A range, e.g. 9-17 |
| / | A step, e.g. */5 is every 5 units |
Common examples
| Expression | Runs |
|---|---|
| * * * * * | Every minute |
| */5 * * * * | Every 5 minutes |
| */10 * * * * | Every 10 minutes |
| */15 * * * * | Every 15 minutes |
| 0 * * * * | Every hour, on the hour |
| 0 */2 * * * | Every 2 hours, on the hour |
| 0 0 * * * | Every day at midnight |
| 30 0 * * * | Every day at 00:30 |
| 0 9 * * 1-5 | 09:00 on weekdays |
Special strings
| String | Equivalent | Runs |
|---|---|---|
| @yearly, @annually | 0 0 1 1 * | Once a year, at midnight on 1 January |
| @monthly | 0 0 1 * * | Once a month, at midnight on the 1st |
| @weekly | 0 0 * * 0 | Once a week, at midnight on Sunday |
| @daily, @midnight | 0 0 * * * | Once a day, at midnight |
| @hourly | 0 * * * * | Once an hour, on the hour |
| @reboot | none | Once at startup, no schedule |
Frequently asked questions
What does */5 mean in cron?
It is a step value. In the minute field, */5 means every 5 minutes (0, 5, 10, and so on). The same syntax works in any field.
How do I run a cron job every day at midnight?
Use 0 0 * * *: minute 0 of hour 0, every day, every month, every weekday.
What does */10 * * * * mean?
Every 10 minutes. The minute field steps through 0, 10, 20, 30, 40 and 50, and the other four fields are wildcards, so the job runs 144 times a day.
What does 30 0 * * * mean?
Every day at 00:30, which is 30 minutes past midnight: minute 30 of hour 0, on every day of every month and every weekday.
Can a cron expression have 6 fields?
Not in a standard crontab, which has exactly five. Schedulers such as node-cron, Spring and Quartz accept a sixth field for seconds (0-59) placed before the minute field, so 1 * * * * * runs at second 1 of every minute. Check which format your scheduler expects before copying an expression between systems.