Development6 min read
Cron Expressions Simplified: A Practical Reference
Demystify cron expressions with clear explanations, visual breakdowns, common schedules, and tips for debugging and generating cron jobs.
D
Digital Tools Hub TeamWhat Are Cron Expressions?
Cron expressions are time-based job schedulers used in Unix-like operating systems and many application frameworks. They define when a task should run using a concise string format.
The 5-Field Cron Format
┌───────────── minute (0 - 59)
│ ┌───────────── hour (0 - 23)
│ │ ┌───────────── day of month (1 - 31)
│ │ │ ┌───────────── month (1 - 12)
│ │ │ │ ┌───────────── day of week (0 - 6) (Sunday to Saturday)
│ │ │ │ │
* * * * *Special Characters
| Character | Meaning | Example |
|---|
|-----------|---------|---------|
| `*` | Every value | `* * * * *` = every minute |
|---|---|---|
| `,` | Value list separator | `0 0 1,15 * *` = 1st and 15th |
| `-` | Range | `0 9-17 * * *` = hourly 9am-5pm |
| `/` | Step values | `*/15 * * * *` = every 15 min |
Common Schedules
| Expression | Description |
|---|
|------------|-------------|
| `* * * * *` | Every minute |
|---|---|
| `*/5 * * * *` | Every 5 minutes |
| `0 * * * *` | Every hour |
| `0 0 * * *` | Every day at midnight |
| `0 9 * * 1-5` | Weekdays at 9am |
| `0 0 1 * *` | First day of every month |
| `0 0 1 1 *` | Once a year (Jan 1st) |
6-Field and Quartz Format
Some systems use extended formats:
- 6-field: Adds seconds field at the beginning
- Quartz: Adds seconds + year field (7 fields total)
Debugging Tips
- Always verify next run times — generate the next few execution times to confirm your schedule
- Watch for day-of-month vs day-of-week conflicts — both are "OR" conditions in standard cron
- Use descriptive comments — document what each cron job does
- Test in a sandbox first — especially for production schedules
Generate Cron Expressions
Our Cron Expression Generator helps you build and validate cron expressions visually. It shows the next execution times and explains each field — all running in your browser.
CronSchedulingDevOps