44 entries

Cron Expression Examples

A cron expression has five fields — minute, hour, day of month, month and day of week — read left to right. An asterisk means every value, a slash sets a step, and a hyphen sets a range. So */5 * * * * runs every five minutes, and 0 9 * * 1-5 runs at nine each weekday. Ranges are inclusive, and times follow the time zone of whatever runs the job.

Almost every cron expression anyone writes is one of about twenty schedules. This page lists them so you can copy the line rather than reconstruct the field order from memory, and explains the two rules that cause most of the surprises: how steps are measured, and what happens when you set both day of month and day of week.

The syntax here is standard Vixie cron, which is what Linux crontab, most CI systems and Kubernetes CronJobs accept. Extensions such as L, W and # appear in Quartz and some hosted schedulers but are not portable, so they are listed separately rather than mixed in with the schedules you can rely on.

Common schedules

22 entries

Copy the expression on the left. Times are in whatever time zone the scheduler runs in, which is usually UTC on a server.

Expression Runs Notes
* * * * * Every minute The shortest interval standard cron supports.
*/5 * * * * Every 5 minutes At :00, :05, :10 and so on — measured from the top of the hour, not from the last run.
*/10 * * * * Every 10 minutes At :00, :10, :20, :30, :40 and :50.
*/15 * * * * Every 15 minutes At :00, :15, :30 and :45.
*/30 * * * * Every 30 minutes At :00 and :30.
0 * * * * Every hour, on the hour The same schedule as the @hourly macro.
0 */2 * * * Every 2 hours At 00:00, 02:00, 04:00 and so on through the day.
0 */6 * * * Every 6 hours At 00:00, 06:00, 12:00 and 18:00.
0 0 * * * Every day at midnight The same schedule as the @daily macro.
30 2 * * * Every day at 02:30 The usual slot for a nightly backup or cleanup job.
0 9 * * 1-5 Weekdays at 09:00 Monday to Friday — 1 is Monday and 5 is Friday.
0 22 * * 1-5 Weekdays at 22:00 A hyphen makes an inclusive range.
0 9,17 * * * Every day at 09:00 and 17:00 A comma makes a list of specific values.
0 9 * * 1 Every Monday at 09:00 A single day-of-week value.
0 0 * * 0 Every Sunday at midnight Both 0 and 7 mean Sunday.
0 0 * * 6 Every Saturday at midnight 6 is Saturday, the last day of the cron week.
0 0 1 * * Midnight on the 1st of every month The same schedule as the @monthly macro.
15 14 1 * * 14:15 on the 1st of every month Minute comes first, then hour — the most common field-order mistake.
0 0 1 */3 * Quarterly, on the 1st Runs in January, April, July and October.
0 0 1 1 * Once a year, on 1 January The same schedule as the @yearly macro.
5 0 * 8 * 00:05 every day in August Restricting the month field limits the job to that month.
0 0 28 * * Midnight on the 28th of every month The safe choice for a monthly job — every month has a 28th.

The five fields

5 entries

Read left to right. Every expression has exactly five, separated by whitespace.

Position Field Allowed values Notes
1 Minute 0–59 Minutes past the hour.
2 Hour 0–23 Twenty-four hour clock — 0 is midnight.
3 Day of month 1–31 A value above 28 skips the months that are shorter.
4 Month 1–12 or JAN–DEC Names are case-insensitive.
5 Day of week 0–7 or SUN–SAT Both 0 and 7 mean Sunday.

Special characters

4 entries

These four work in every field, in every implementation.

Character Meaning Example
* Every value the field allows * * * * * — every minute
, A list of specific values 0 9,12,17 * * * — at 09:00, 12:00 and 17:00
- An inclusive range 0 9 * * 1-5 — Monday through Friday
/ A step within a range */20 * * * * — at :00, :20 and :40

Shorthand macros

8 entries

Accepted by Vixie cron and most schedulers in place of the five fields. Easier to read, but they cannot be adjusted — the moment you want 00:30 rather than midnight you need a full expression.

Macro Equivalent Runs
@yearly 0 0 1 1 * Midnight on 1 January.
@annually 0 0 1 1 * The same as @yearly.
@monthly 0 0 1 * * Midnight on the 1st of each month.
@weekly 0 0 * * 0 Midnight on Sunday.
@daily 0 0 * * * Midnight every day.
@midnight 0 0 * * * The same as @daily.
@hourly 0 * * * * The top of every hour.
@reboot no equivalent Once, when the scheduler starts. Not supported everywhere.

Non-standard extensions

5 entries

These appear in Quartz, Spring and some hosted schedulers. Vixie cron rejects them, so check what your scheduler accepts before using one.

Token Meaning Where it works
L Last — the last day of the month, or the last given weekday Quartz, Spring and some hosted schedulers.
W The nearest weekday to a given day of the month Quartz and Spring.
# The nth given weekday of the month, as in 6#3 for the third Friday Quartz and Spring.
? No specific value, used in place of * in one of the two day fields Quartz, where it is required rather than optional.
A seconds field A sixth field placed before the minute Quartz and Spring. Linux crontab and Kubernetes expect five fields.

Notes

  • A step counts from the start of the range, not from the previous run. */5 in the minute field means minutes 0, 5, 10 and so on within each hour, so a job that last ran at 09:58 next runs at 10:00 — two minutes later, not five.
  • When both the day-of-month and the day-of-week field are restricted, cron runs the job when either matches, not both. 0 0 1 * 1 runs on the 1st of the month and on every Monday, roughly five times a month. Restrict one field, leave the other as an asterisk, and test the second condition inside the job.
  • Cron uses the time zone of whatever runs it, which on a server is usually UTC rather than yours. Daylight saving transitions can skip a run or repeat it, so anything that must happen exactly once a day is safer scheduled outside the 01:00–03:00 window.
  • The command runs under /bin/sh with a minimal environment, not your login shell. A job that works when pasted into a terminal but fails under cron is almost always missing PATH or an environment variable it was relying on.

Frequently asked questions

What does */5 * * * * mean?
Run every five minutes — at minute 0, 5, 10, 15 and so on past each hour. The slash sets a step through the field, and because the step counts from the start of the range rather than from the last run, the schedule stays fixed to the clock no matter when the job previously finished.
How do I run a job every day at a specific time?
Put the minute first and the hour second, then leave the last three fields as asterisks. 02:30 every day is 30 2 * * *, and 17:45 is 45 17 * * *. Writing the hour first is the most common mistake, and it produces a schedule that looks plausible but runs at the wrong time.
Why does my job with both a day of month and a weekday run too often?
Because cron treats the two day fields as an OR rather than an AND. 0 0 1 * 1 runs on the 1st of the month and on every Monday, which is about five times a month instead of once. Restrict one field, leave the other as an asterisk, and check the second condition inside the job itself.
Which time zone does cron use?
The time zone of the machine or scheduler running it, which on a server is normally UTC rather than your own. Kubernetes CronJobs, most CI systems and Laravel all let you set a time zone explicitly, which is worth doing for any job where the local hour matters to somebody.
Is @daily the same as 0 0 * * *?
Yes — in Vixie cron they are identical, and @midnight is a third spelling of the same schedule. The macro reads better, but it cannot be adjusted, so as soon as you want 00:30 instead of midnight you need the five-field expression anyway.
What is the shortest interval cron can run?
One minute. Standard cron has no seconds field, so anything more frequent needs a different mechanism — a long-running process with a sleep in it, a systemd timer, or a scheduler such as Quartz that does accept seconds.

Related tools

All tools →
All references →

Last reviewed .