All posts

Cron Expressions: A Complete Guide with Examples

Learn cron syntax from scratch — fields, wildcards, ranges, and step values — with practical examples and a free visual cron builder.

What Is a Cron Expression?

A cron expression is a string of five fields that defines a schedule. It's used by Unix crontab, Kubernetes CronJobs, GitHub Actions, AWS CloudWatch, and most task schedulers.

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

The Five Fields

FieldValuesSpecial Characters
Minute0-59`*` `,` `-` `/`
Hour0-23`*` `,` `-` `/`
Day of month1-31`*` `,` `-` `/`
Month1-12`*` `,` `-` `/`
Day of week0-6`*` `,` `-` `/`

Special Characters Explained

  • * — every value ("every minute", "every hour")
  • , — list: 1,15 means "1st and 15th"
  • - — range: 1-5 means "Monday through Friday"
  • / — step: */15 means "every 15"

10 Most Common Examples

* * * * *        Every minute
0 * * * *        Every hour (at minute 0)
0 0 * * *        Daily at midnight
0 9 * * 1-5      Weekdays at 9 AM
0 0 1 * *        First of every month at midnight
*/15 * * * *     Every 15 minutes
0 */2 * * *      Every 2 hours
30 4 * * *       Daily at 4:30 AM
0 9 * * 1        Every Monday at 9 AM
0 0 * * 0        Every Sunday at midnight

Common Mistakes

1. Day of Week Numbering

Some systems use 0=Sunday, others use 1=Monday. Always check your scheduler's documentation.

2. Day of Month + Day of Week

Using both fields creates an OR condition in cron (runs if either matches), but some schedulers treat it as AND. Test before relying on this.

3. Timezone

Cron expressions don't include timezone. The schedule runs in whatever timezone the server or scheduler is configured for. Document this!

4. Missing Leading Zeros

9 and 09 are the same in cron. But 9 in month means September, not 9 AM — make sure you're in the right field.

Build Cron Expressions Visually

Cron syntax is hard to memorize. Use our [free cron expression generator](/tools/cron-expression-generator) to build expressions visually. Pick from presets, modify individual fields, and see the next 5 scheduled runs instantly.

Cron Jobs and Error Monitoring

Cron jobs fail silently. A backup script that hasn't run in 3 days? A cleanup job that's been erroring for a week? You won't know unless you monitor them.

Bugsly's cron monitoring tracks your scheduled jobs and alerts you when they miss a window or start failing. [Set up cron monitoring](/signup) in 2 minutes.

Try Bugsly Free

AI-powered error tracking that explains your bugs. Set up in 2 minutes, free forever for small projects.

Get Started Free