Cron Expressions — A Practical Guide with Examples & Next Run Times
Master cron expressions for scheduling tasks. Learn syntax, examples, and how to parse cron expressions with our free online tool.
# Cron Jobs: How to Read Those Star and Slash Patterns
Cron is a Linux scheduler that runs tasks at fixed times. If you've ever seen 0 9 * * 1-5 and wondered what it means, this is for you.
The 5 Fields
minute hour day-of-month month day-of-week
| Field | Range | Special Characters |
|---|---|---|
| minute | 0-59 | * / - , |
| hour | 0-23 | * / - , |
| day of month | 1-31 | * / - , ? L |
| month | 1-12 | * / - , |
| day of week | 0-7 (0=Sun) | * / - , ? L |
Patterns I Use Regularly
Every weekday at 9am:
`
0 9 * * 1-5
`
Every 15 minutes:
`
*/15 * * * *
`
First of every month at midnight:
`
0 0 1 * *
`
Every Sunday at 2am:
`
0 2 * * 0
`
Every 6 hours:
`
0 */6 * * *
`
The Tricky Parts
Day of month vs day of week: If both are specified (not *), cron runs when EITHER matches. 0 0 13 * 5 runs on the 13th AND on Fridays, not just Friday the 13th.
*/N doesn't always mean every N units: */10 in the minute field means minutes 0, 10, 20, 30, 40, 50. But if you start at 3, there's no 3-59/10 shortcut in standard cron.
Timezones matter: Cron runs in the server's timezone. If your server is in UTC and you want 9am EST, that's 0 14 * * * (14:00 UTC = 9:00 EST).
Parsing Cron Expressions
Reading cron takes practice. If you're debugging a schedule or want to confirm what a expression does, use our Cron Parser — paste the expression, get a human-readable description and the next 5 execution times. Free, no signup.
## Cron Expression Fields Explained
A cron expression has five fields (in traditional cron) or six (in some modern systems with seconds):
# Traditional 5-field cron
# minute hour day-of-month month day-of-week
0 9 * * 1-5 # 9:00 AM, Monday through Friday
0 */2 * * * # Every 2 hours
0 0 1 * * # Midnight on the 1st of every month
| Field | Allowed Values | Special Characters |
|---|---|---|
| Minute | 0-59 | * , - / |
| Hour | 0-23 | * , - / |
| Day of month | 1-31 | * , - / L W |
| Month | 1-12 or JAN-DEC | * , - / |
| Day of week | 0-6 or SUN-SAT | * , - / L # |
Common Cron Patterns
0 0 * * *— Daily at midnight0 0 * * 0— Every Sunday at midnight (weekly)0 0 1 * *— First day of every month at midnight0 9 * * 1-5— Weekdays at 9:00 AM*/15 * * * *— Every 15 minutes0 0 1 1 *— January 1st at midnight (yearly)0 0 L * *— Last day of every month (L = last)
Cron Pitfalls
- Day of month vs day of week: If both are specified (not
*), cron runs when EITHER matches, not both.0 0 13 * 5runs on Friday the 13th AND every Friday, not just Friday the 13th. - Timezone issues: Cron uses the server timezone. If your server is in UTC but your users are in New York, 9:00 AM cron runs at 5:00 AM EST.
- DST transitions: When daylight saving time changes, cron jobs may run twice or not at all. Use UTC to avoid this.
- Long-running jobs: If a job takes longer than the interval, multiple instances may overlap. Use a lock file or a job queue.