What is a cron expression?
A cron expression is a schedule written as five fields separated by spaces. Cron, the job scheduler built into Linux and macOS, reads it to decide when to run a command. The same format is used by Kubernetes CronJobs, GitHub Actions, GitLab CI, Cloudflare Workers and many job queues.
┌───────────── minute (0–59)
│ ┌─────────── hour (0–23)
│ │ ┌───────── day of month (1–31)
│ │ │ ┌─────── month (1–12 or JAN–DEC)
│ │ │ │ ┌───── day of week (0–6 or SUN–SAT; 7 is also Sunday)
│ │ │ │ │
0 9 * * 1-5
0 9 * * 1-5 means minute 0 of hour 9, on any day of the month, in any month, Monday to Friday: 09:00 every weekday.
How to use this cron generator
- Pick a common schedule, or type an expression into Expression.
- Read the plain-English description under it to check it does what you mean.
- Adjust one field at a time under Build it field by field. Each field shows the values it allows.
- Check Next 10 runs, choosing the time zone your server uses.
- Enter your command under Crontab line and copy the finished line.
Cron syntax: special characters
| Character | Meaning | Example |
|---|---|---|
* | Any value | * in the hour field: every hour |
, | A list of values | 1,15 in day of month: the 1st and 15th |
- | A range | 9-17 in the hour field: 09:00 to 17:00 |
/ | A step | */10 in the minute field: every 10 minutes |
Ranges and steps combine: 9-17/2 in the hour field means 09:00, 11:00, 13:00, 15:00 and 17:00. Month and weekday names such as JAN or MON work in any letter case.
Cron expression examples
| Expression | Meaning |
|---|---|
* * * * * | Every minute |
*/5 * * * * | Every 5 minutes |
0 * * * * | Every hour |
0 0 * * * | At 00:00 |
30 2 * * * | At 02:30 |
0 9 * * 1-5 | At 09:00, Monday through Friday |
0 3 * * 0 | At 03:00, only on Sunday |
0 0 1 * * | At 00:00, on day 1 of the month |
0 0 1 */3 * | At 00:00, on day 1 of the month, every 3 months |
0 0 1 1 * | At 00:00, on day 1 of the month, only in January |
Shortcuts are accepted too: @hourly, @daily (or @midnight), @weekly, @monthly and @yearly (or @annually). @reboot runs once at start-up rather than on a schedule.
Day of month and day of week: the OR rule
When both day fields are restricted, cron runs if either one matches. 0 0 13 * 5 does not mean Friday the 13th; it runs on the 13th of every month and on every Friday. If either field starts with *, only the other one counts, so 0 0 * * 5 runs only on Fridays.
Time zones and daylight saving time
Cron has no time zone of its own. It uses the clock of the machine it runs on, which is usually UTC on servers and in containers. GitHub Actions always uses UTC, and Kubernetes CronJobs can set a timeZone.
In zones with daylight saving time, two days a year behave differently. When clocks go forward, a skipped time never happens: 30 2 * * * does not run on 8 March 2026 in New York. When clocks go back, a time happens twice, and cron runs the job once. The run times above follow these rules, and jobs that must run exactly once are safest scheduled in UTC.
Cron dialects: Quartz, Spring and AWS
Not every scheduler uses five fields. Quartz and Spring add a seconds field at the start, AWS EventBridge adds a year field at the end, and they use ? for "no specific value", L for "last", W for "nearest weekday" and # for "the nth weekday". Choose the format above to build, read and preview any of them:
| Format | Fields | Example (weekdays at 09:00) |
|---|---|---|
| Standard cron | minute hour day month weekday | 0 9 * * 1-5 |
| Spring | second minute hour day month weekday | 0 0 9 * * MON-FRI |
| Quartz | second minute hour day month weekday [year] | 0 0 9 ? * MON-FRI |
| AWS EventBridge | minute hour day month weekday year | cron(0 9 ? * MON-FRI *) |
Quartz and AWS number weekdays from 1 (Sunday) to 7 (Saturday), so 2-6 means Monday to Friday there; day names avoid the confusion. They also need ? in exactly one of the two day fields.
Adding the job to crontab
crontab -e # edit your schedule
crontab -l # list it
Each line is an expression followed by the command. Cron runs commands with a minimal environment, so use full paths and send output somewhere you can read it:
0 9 * * 1-5 /usr/local/bin/backup.sh >> /var/log/backup.log 2>&1