Menu

Cron Expression Generator

Min Hour Day Mon Dow
* * * * *
Common Presets

Cron Expression Generator: How It Works

A cron expression is five fields describing when a job should run. The syntax is compact and unforgiving, and a single misplaced asterisk is the difference between a job running monthly and running every minute of a particular day.

The five fields

*  *  *  *  *
|  |  |  |  |
|  |  |  |  +-- day of week   (0-7, 0 and 7 both Sunday)
|  |  |  +----- month         (1-12)
|  |  +-------- day of month  (1-31)
|  +----------- hour          (0-23)
+-------------- minute        (0-59)
OperatorMeaningExample
*Every value* * * * * — every minute
,A list0 9,17 * * * — 09:00 and 17:00
-A range0 9-17 * * * — hourly, 09:00 to 17:00
/A step*/15 * * * * — every 15 minutes

Common schedules

ExpressionRuns
0 * * * *Every hour, on the hour
*/5 * * * *Every five minutes
0 3 * * *Daily at 03:00
0 3 * * 1Mondays at 03:00
0 3 1 * *First of the month at 03:00
30 8 * * 1-5Weekdays at 08:30
0 0 1 1 *Once a year, 1 January

The mistake everyone makes once

* 3 * * * does not mean 'at 3am'. The minute field is an asterisk, so it runs every minute during the 3am hour — sixty executions. The correct expression is 0 3 * * *. Any field left as * means 'every value of this field', and the leftmost fields are the ones that bite.

Day-of-month and day-of-week together

When both are restricted, most cron implementations treat them as OR, not AND. 0 0 13 * 5 runs on the 13th of every month and on every Friday — not only on Friday the 13th. Restricting both fields rarely does what people intend, so restrict one and filter inside the job if you need the intersection.

Timezones and DST

Cron uses the server's local time unless configured otherwise. If that timezone observes daylight saving, a job scheduled at 02:30 may run twice or not at all on transition days. Running scheduled work in UTC avoids the problem entirely, and is the standard recommendation for anything where a missed or duplicated run matters.

Practical habits

Non-standard extensions

Some systems add a seconds field at the front, making six fields — Quartz and Spring do this, and pasting a five-field expression into them shifts every value. Others support shorthand such as @daily, @hourly and @reboot. Check which dialect your scheduler uses before copying an expression from elsewhere.

Frequently Asked Questions

Why did my job run sixty times?
The minute field was left as an asterisk. '* 3 * * *' runs every minute during the 3am hour. Set the minute explicitly: '0 3 * * *'.
How do I run something on Friday the 13th only?
You cannot with cron alone, because day-of-month and day-of-week are combined with OR when both are restricted. Schedule for the 13th of each month and check the weekday inside the job.
What timezone does cron use?
The server's local timezone unless configured otherwise. Running scheduled jobs in UTC avoids daylight saving transitions, where a job can otherwise run twice or be skipped entirely.
Why does my job work manually but fail on schedule?
Almost always the environment. Cron runs with a minimal PATH and none of your shell profile. Use absolute paths for every command and file, and set any variables the job needs inside the job itself.
How do I stop overlapping runs?
Cron starts each run on schedule regardless of whether the previous finished. Wrap the command in flock, or have the script create and check a lock file, so a long run cannot be doubled up.
Why does my expression have six fields?
Some schedulers, including Quartz and Spring, add a leading seconds field. Pasting a standard five-field expression into one of those shifts every value by one position, so check which dialect you are targeting.

Related Developer Tools

Browse all Developer tools →