Cron Expressions Explained, With 25 Real Examples

By The UtilCraft team · 4 min read ·

Cron syntax is five little fields that everyone has to look up, every time. This guide explains how to read them once and for all, then gives you 25 schedules you can copy, each one checked against how standard cron actually behaves. Paste any of them into the Cron Expression Generator to see its next run times.

The five fields

minute  hour  day-of-month  month  day-of-week
  0-59  0-23          1-31   1-12          0-7

Read it left to right: at this minute, of this hour, on this day of the month, in this month, on this weekday. A * means "any". So 30 6 * * *reads as "at minute 30 of hour 6, any day, any month, any weekday": 06:30 every day.

Four operators cover everything else:

  • Lists with commas: 0 9,13,17 * * * runs at 09:00, 13:00 and 17:00.
  • Ranges with a hyphen: 1-5 in the weekday field means Monday to Friday.
  • Steps with a slash: */15 in the minute field means every 15 minutes. 9-17/2 in the hour field means 9, 11, 13, 15 and 17.
  • Names for months and weekdays: JAN–DEC, SUN–SAT. Most implementations accept them, and they make expressions much easier to read.

Sunday can be written as either 0 or 7. Many systems also accept shortcuts: @hourly, @daily, @weekly, @monthly and @yearly, plus @reboot in crontab to run once at startup.

25 schedules you can copy

Every few minutes or hours

ExpressionRuns
* * * * *Every minute
*/5 * * * *Every 5 minutes
*/15 * * * *Every 15 minutes (:00, :15, :30, :45)
7,37 * * * *Twice an hour, at :07 and :37
0 * * * *Every hour, on the hour
0 */2 * * *Every 2 hours (00:00, 02:00, 04:00…)
0 */6 * * *Every 6 hours (00:00, 06:00, 12:00, 18:00)

Daily

ExpressionRuns
0 0 * * *Every day at midnight
30 2 * * *Every day at 02:30
0 9,17 * * *Every day at 09:00 and 17:00
*/10 9-17 * * *Every 10 minutes between 09:00 and 17:59

Weekly

ExpressionRuns
0 9 * * 1-5Weekdays at 09:00
0 10 * * 6,0Weekends at 10:00
0 8 * * MONEvery Monday at 08:00
0 18 * * FRIEvery Friday at 18:00
0 3 * * 0Every Sunday at 03:00

Monthly and yearly

ExpressionRuns
0 0 1 * *First day of every month at midnight
0 9 15 * *The 15th of every month at 09:00
0 0 1,15 * *The 1st and 15th of every month
0 6 1 */3 *First day of every quarter (Jan, Apr, Jul, Oct) at 06:00
0 0 1 1 *Once a year, on 1 January at midnight
0 12 25 DEC *Christmas Day at noon

Trickier ones

ExpressionRuns
0 9 1-7 * *First 7 days of each month at 09:00 (check for Monday in the script to get 'first Monday')
0 23 28-31 * *Days 28–31 at 23:00 (check for 'tomorrow is the 1st' in the script to get 'last day of month')
0 0 29 2 *29 February only, so once every four years

The mistakes that catch everyone

1. "Every 2 hours" written as * */2 * * *

This runs every minute of every second hour, 60 times in a row. The minute field needs a fixed value: 0 */2 * * *. Whenever you change the hour field, check what the minute field says.

2. Combining day of month and day of week

If both fields are restricted, standard cron runs when either matches, not both. 0 9 13 * 5 is not "Friday the 13th"; it's every 13th and every Friday. The workaround is to schedule on one condition and test the other inside the job:

0 9 13 * *  [ "$(date +\%u)" = 5 ] && /usr/local/bin/spooky-report

Note the \%. In a crontab, an unescaped % is turned into a newline, which is a baffling bug the first time you meet it.

3. Steps don't wrap around neatly

*/7in the minute field runs at 0, 7, 14, … 56, and then again at 0. That's a 4-minute gap at the top of the hour, not 7. Steps restart at the beginning of each hour (or day, or month), so pick values that divide evenly: 1, 2, 3, 4, 5, 6, 10, 12, 15, 20 or 30 for minutes.

4. Forgetting the time zone

A crontab uses the server's time zone, which on cloud machines is usually UTC. GitHub Actions schedules and AWS EventBridge cron rules are always UTC. If your team is in New York, "9am" is 13:00 or 14:00 UTC depending on daylight saving time. Kubernetes CronJobs let you set a timeZone field, which avoids the problem entirely.

5. Copying Quartz syntax into crontab

Java's Quartz scheduler (also used by Spring and some cloud services) has a seconds field at the start and extra symbols like ?, L (last) and # (nth weekday). An expression such as 0 0 12 ? * MON-FRI is valid in Quartz and an error in crontab. AWS EventBridge uses yet another six-field variant, with a year at the end.

A pre-flight checklist

  • Paste the expression into a tool that lists the next run times, and read them. It catches nearly every mistake above.
  • Confirm the time zone of wherever the job will run.
  • Use absolute paths for commands and files; cron's PATH is minimal.
  • Redirect output to a log: >> /var/log/job.log 2>&1.
  • If a run might take longer than the interval, prevent overlaps with flock -n.
  • Avoid 02:00–03:00 local time in zones with daylight saving; that hour is skipped once a year and repeated once.

Cron has been around since the 1970s and its syntax isn't going anywhere. Learn the five fields and the day-of-month/day-of-week rule, always check the next run times, and it's a remarkably dependable tool.

Tools used in this guide

Keep reading