Cron Expression Complete Guide for Developers

Cron is a time-based job scheduler built into Unix-like operating systems. A cron expression is a compact string that defines when a job should run. Once you understand the five fields and the handful of special characters, you can express almost any schedule imaginable — from "every minute" to "at 8:45 AM on the first Monday of every quarter".

The five fields

Every cron expression has exactly five fields separated by spaces:

┌─ minute        (0 – 59)
│ ┌─ hour         (0 – 23)
│ │ ┌─ day/month  (1 – 31)
│ │ │ ┌─ month    (1 – 12)
│ │ │ │ ┌─ day/week (0 – 6, 0 = Sunday)
│ │ │ │ │
* * * * *

Special characters

  • * — matches every possible value for that field.
  • , — list separator. 1,3,5 means 1st, 3rd, and 5th.
  • - — range. 1-5 means 1 through 5.
  • / — step. */10 means every 10 units.

10 practical examples

  • * * * * * — every minute
  • 0 * * * * — every hour on the hour
  • 0 0 * * * — every day at midnight
  • 0 9 * * 1-5 — weekdays at 9:00 AM
  • */15 * * * * — every 15 minutes
  • 0 0 1 * * — first day of every month at midnight
  • 30 18 * * 5 — every Friday at 6:30 PM
  • 0 8,12,18 * * * — at 8 AM, noon, and 6 PM daily
  • 0 0 * * 0 — every Sunday at midnight
  • 0 2 * * 1 — every Monday at 2:00 AM (good for weekly backups)

Common mistakes to avoid

  • Confusing day-of-week numbering — Sunday is 0 on most systems, but 7 is also accepted on some.
  • Forgetting that month and day-of-month are 1-indexed while hour and minute are 0-indexed.
  • Using 0/5 instead of */5 — both work but */5 is clearer.
  • Writing cron expressions with six fields for standard crontab — the sixth field (year) is only used by some schedulers like Quartz.

Platform differences

Cron syntax is mostly standard, but a few platforms have quirks:

  • GitHub Actions — uses standard 5-field cron in UTC. Minimum interval is every 5 minutes.
  • AWS EventBridge — uses a 6-field cron where the 6th field is year, and you cannot specify both day-of-month and day-of-week; one must be ?.
  • GCP Cloud Scheduler — uses standard 5-field unix cron in the timezone you specify.
  • node-cron (Node.js) — supports an optional 6th field for seconds at the beginning.

Generate cron expressions without memorising the syntax

Instead of writing cron manually, use our free Cron Expression Generator — describe your schedule in plain English like "every weekday at 9am" and get the correct expression instantly with an explanation of each field.