Cron Expressions Explained: Schedule Jobs Like a Pro
June 2026 · 5 min read · Tools, Basics, Web Dev
What is a Cron Job?
Cron is a time-based job scheduler in Unix-like operating systems. A cron job is a command or script that runs automatically at specified time intervals — without any human intervention. Cron is used to automate repetitive tasks such as:
- Sending daily email reports or newsletters
- Running database backups every night
- Clearing temporary files or expired sessions weekly
- Fetching data from APIs on a schedule
- Generating and caching analytics reports
- Rotating log files daily
Cron expressions are also used beyond Linux — in cloud schedulers (AWS EventBridge, GCP Cloud Scheduler), CI/CD pipelines (GitHub Actions scheduled workflows), task queues (Celery, Sidekiq), and application frameworks (Spring @Scheduled, Laravel Artisan).
The 5-Field Cron Format
A standard cron expression has 5 space-separated fields:
┌───────────── minute (0–59)
│ ┌───────────── hour (0–23)
│ │ ┌───────────── day of month (1–31)
│ │ │ ┌───────────── month (1–12)
│ │ │ │ ┌───────────── day of week (0–6, 0=Sunday)
│ │ │ │ │
* * * * *| Field | Allowed Range | 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 (0=Sun) or SUN–SAT | * , - / ? L # |
Special Characters Explained
Common Cron Expression Examples
| Expression | Meaning |
|---|---|
| 0 * * * * | Every hour, on the hour (e.g., 1:00, 2:00, 3:00) |
| 0 0 * * * | Every day at midnight (00:00) |
| 0 9 * * 1-5 | Every weekday (Mon–Fri) at 9:00 AM |
| */15 * * * * | Every 15 minutes |
| 0 0 1 * * | First day of every month at midnight |
| 30 8 * * 1 | Every Monday at 8:30 AM |
| 0 0 * * 0 | Every Sunday at midnight |
| 0 2 * * * | Every day at 2:00 AM (common for backups) |
| 0 */6 * * * | Every 6 hours (00:00, 06:00, 12:00, 18:00) |
| 5 4 * * sun | Every Sunday at 4:05 AM |
Build and Test Cron Expressions Online
Use the JSONHint Cron Expression Generator to visually build cron schedules using dropdowns and sliders — no need to memorize the syntax. The tool shows you a plain-English description of your schedule and lists the next 5 run times.
Related Tools