Anatomy of a five-field cron expression
Standard Unix cron reads five space-separated fields: minute (0 to 59), hour (0 to 23), day of month (1 to 31), month (1 to 12 or JAN to DEC) and day of week (0 to 7 or SUN to SAT, where both 0 and 7 mean Sunday). A job runs whenever the current time matches every field.
Each field accepts a small set of operators that combine into most schedules you will need.
- An asterisk matches every value in the field.
- A comma lists values: 1,15 in the day-of-month field means the 1st and the 15th.
- A hyphen gives an inclusive range: 1-5 in the day-of-week field means Monday to Friday.
- A slash sets a step: */10 in the minute field means 0, 10, 20, 30, 40 and 50.
Reading real schedules field by field
Work left to right and translate each field on its own before combining them. A few examples show the pattern:
The summary on this page interprets all five fields, including lists, ranges, steps such as */15 or 0-20/2 and month and weekday names, and lists the next five run times in your browser's local time zone so you can check the reading against real dates.
- 30 9 * * 1-5 runs at 09:30 Monday to Friday.
- 0 */2 * * * runs on the hour every second hour: 00:00, 02:00, 04:00 and so on.
- */15 9-17 * * * runs every 15 minutes from 09:00 up to and including 17:45.
- 0 0 1 1 * runs at midnight on 1 January only.
- 0 0 1 * * runs at midnight on the first day of every month.
The day-of-month and day-of-week trap
When both the day-of-month and day-of-week fields are restricted, classic cron runs the job if either one matches, not both. The expression 0 0 13 * 5 does not mean Friday the 13th. It runs at midnight on every 13th of the month and also on every Friday.
If you really need both conditions, schedule on one and test the other inside the command, for example running every Friday and exiting early unless date +%d returns 13. Inside a crontab file, percent signs must be escaped as \% because cron treats a bare % as a newline.
Production pitfalls: time zones, missed runs and dialects
Cron uses the time zone of the machine or service running it, and many servers run in UTC. A job written as 0 9 * * * on a UTC server fires at 14:30 in India and at 04:00 or 05:00 in New York depending on daylight saving. GitHub Actions schedules are always evaluated in UTC.
Around daylight saving changes, a job scheduled inside the skipped hour may not run and one inside the repeated hour may run twice, depending on the implementation. Cron also does not catch up on runs missed while the machine was off; anacron or a scheduler with catch-up support handles that.
Not every scheduler speaks the same dialect. Kubernetes CronJobs use the standard five fields, Quartz in Java adds a seconds field and uses ? for an unspecified day, and AWS EventBridge uses six fields including a year. An expression that works in one may be rejected by another, so check which format your platform expects.
Cron Expression Parser: frequently asked questions
Do 0 and 7 both mean Sunday in cron?
Yes, in Vixie cron and most of its descendants both values are accepted for Sunday. Using 0 is the more portable choice, and three-letter names such as SUN are clearer still where your implementation supports them.
Why does */7 in the minute field not run exactly every 7 minutes?
Steps restart at the beginning of each hour. */7 matches minutes 0, 7, 14 and so on up to 56, then the next run is at minute 0 of the following hour, only four minutes later. Choose a step that divides 60 evenly (such as 5, 10, 15 or 20) when even spacing matters.
How do I run a job every 90 minutes?
A single standard expression cannot do it, but two lines can. Use 0 0-21/3 * * * for 00:00, 03:00 and so on, plus 30 1-22/3 * * * for 01:30, 04:30 and so on. Together they produce runs exactly 90 minutes apart all day.
How do I schedule a job on the last day of the month?
Standard cron has no last-day operator. A common approach is to run on days 28 to 31 and let the command check whether tomorrow is the 1st, for example with GNU date -d tomorrow +\%d. Quartz and some cloud schedulers support an L character for this directly.
What do shortcuts like @daily and @reboot mean?
Many cron implementations accept nicknames: @hourly, @daily (same as 0 0 * * *), @weekly, @monthly, @yearly and @reboot, which runs once at startup. They are not part of the five-field syntax, so tools and platforms that expect five fields may reject them.