Skip to main content

Cron syntax explained (with a every-5-minutes example)

7 min read

The five cron fields, what each one accepts, and copy-paste expressions for every 5 minutes, weekdays, midnight and more.

A cron expression is five fields separated by spaces. Each field controls one part of the schedule, and together they answer a single question: at which minutes should this job run? The expression for every 5 minutes is */5 * * * *. The rest of this guide explains why, so you can write any schedule yourself.

The five fields

Reading left to right, a cron line looks like this:

* * * * *
│ │ │ │ │
│ │ │ │ └── day of week  (0-6, Sun=0; or SUN-SAT)
│ │ │ └──── month        (1-12; or JAN-DEC)
│ │ └────── day of month (1-31)
│ └──────── hour         (0-23)
└────────── minute       (0-59)

An asterisk (*) means “every value”. So * * * * * runs once a minute, forever.

The four operators every field accepts

  • *: every value. * * * * * is every minute.
  • ,: a list. 0 9,17 * * * runs at 09:00 and 17:00.
  • -: a range. 0 9-17 * * * runs hourly from 09:00 through 17:00.
  • /: a step. */5 in the minute field means every 5th minute. Steps can follow a range too: 0-30/10 is 0, 10, 20, 30.

Copy-paste examples

*/5 * * * *     every 5 minutes
*/10 * * * *    every 10 minutes
0 * * * *       every hour, on the hour
0 */2 * * *     every 2 hours
0 0 * * *       every day at midnight
30 8 * * *      every day at 08:30
0 9 * * 1-5     weekdays at 09:00
0 0 * * 0       every Sunday at midnight
0 0 1 * *       the 1st of every month at midnight
0 9-17 * * 1-5  hourly, 09:00-17:00, Mon-Fri

Why every 5 minutes is */5 * * * *

The step operator does the work. */5 in the minute field expands to 0,5,10,15,20,25,30,35,40,45,50,55. Every other field is *, so the schedule places no restriction on the hour, day, month or weekday. The job therefore fires at those twelve minute-marks of every hour.

A common mistake is writing 5 * * * *, which runs only at minute 5 of each hour, once an hour, not every five minutes. The slash is what makes it a repeating step.

Two gotchas worth knowing

Day-of-month OR day-of-week. If both of those fields are set to something other than *, the job runs when either matches. 0 0 13 * 5 runs on the 13th and on every Friday, not only on Friday the 13th.

Time zones. Cron interprets the expression in the server’s time zone. If that server runs UTC and you think in local time, your 9 a.m. job may fire at a surprising hour, and during daylight-saving transitions some local times occur twice or not at all.

The fastest way to be sure an expression does what you meant is to see its next run times spelled out. Paste it into our free cron expression generator, which explains each field in plain English and lists the next five runs.

Frequently asked questions

What is the cron expression for every 5 minutes?
Use */5 * * * *. The */5 in the minute field means 'every 5th minute' (0, 5, 10, … 55), and the four asterisks mean every hour, every day of the month, every month, and every day of the week.
What are the five fields of a cron expression?
In order: minute (0–59), hour (0–23), day of month (1–31), month (1–12 or JAN–DEC), and day of week (0–6 or SUN–SAT, where 0 is Sunday). Each field accepts * (every), a single value, a range like 9-17, a list like 1,15, or a step like */15.
Does standard cron support seconds?
No. Classic 5-field cron (Vixie cron, Linux crontab) has a one-minute resolution. Quartz (Java) and some cloud schedulers add a leading seconds field, giving a 6-field expression, but that is a different dialect.
Why does 0 0 1 * 1 run more often than I expect?
When both the day-of-month and day-of-week fields are restricted, cron runs when EITHER matches, not both. So 0 0 1 * 1 fires at midnight on the 1st of the month AND every Monday. Leave one of the two as * to avoid the surprise.