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,5means 1st, 3rd, and 5th.-— range.1-5means 1 through 5./— step.*/10means every 10 units.
10 practical examples
* * * * *— every minute0 * * * *— every hour on the hour0 0 * * *— every day at midnight0 9 * * 1-5— weekdays at 9:00 AM*/15 * * * *— every 15 minutes0 0 1 * *— first day of every month at midnight30 18 * * 5— every Friday at 6:30 PM0 8,12,18 * * *— at 8 AM, noon, and 6 PM daily0 0 * * 0— every Sunday at midnight0 2 * * 1— every Monday at 2:00 AM (good for weekly backups)
Common mistakes to avoid
- Confusing day-of-week numbering — Sunday is
0on most systems, but7is also accepted on some. - Forgetting that month and day-of-month are 1-indexed while hour and minute are 0-indexed.
- Using
0/5instead of*/5— both work but*/5is 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.