hackandhost

Blog · · 2 min read

Cron expression explainer

Paste a cron expression to read it in plain English and see when it will run next, or build one field by field.

Cron expressions are short enough to write from memory and easy to get wrong. Type one below to see what it means, the next eight run times, and an hour-by-hour map of the coming week. Everything runs in your browser.

Minute*/150, 15, 30, 45
Hour9-179, 10, 11, 12, 13, 14 … (9)
Day of month*any
Month*any
Day of week1-5MON, TUE, WED, THU, FRI

Every 15 minutes, between 09:00 and 17:59, on Monday through Friday.

Try

Build it field by field

*/15
every starting at
9-17
from to
*
*
1-5
from to

Next runs

Times shown in your time zone, local

  • Working out run times…

Next 7 days

– runs
00061218

Each square is one hour; darker means more runs in that hour.

Reading a cron expression

Standard cron has five fields, separated by spaces:

Field Allowed values
Minute 0–59
Hour 0–23
Day of month 1–31
Month 1–12 or JAN–DEC
Day of week 0–7 or SUN–SAT (0 and 7 are both Sunday)

Each field takes a few kinds of value:

  • * means every value.
  • , makes a list: 1,15 is the 1st and the 15th.
  • - makes a range: 9-17 is 9 am to 5 pm.
  • / sets a step: */10 is every 10th value, and 0-30/5 is every 5 minutes in the first half of the hour.

There are also shortcuts: @hourly, @daily (or @midnight), @weekly, @monthly, @yearly (or @annually), and @reboot, which runs once when the cron daemon starts.

Things that catch people out

  • The two day fields combine strangely. If both are set, the job runs when either matches, so 0 9 1 * 1 runs on the 1st and every Monday. I wrote about this in Cron's day fields don't mean what you think.
  • Cron uses the server's time zone, which is often UTC. The Local/UTC switch above shows both.
  • Steps restart every hour or day. With */7, minute 56 is followed by minute 0, not minute 3.
  • There are no seconds. Quartz, Spring and AWS EventBridge use six or seven fields and add L, W, # and ?. The tool tells you when it sees those.
  • Days 29 to 31 skip short months, so 0 0 31 * * runs only seven times a year.

Kubernetes CronJobs and GitHub Actions use the same five-field format. GitHub Actions schedules always run in UTC.