Skip to main contentSkip to navigationSkip to searchSkip to footer

How to Write Cron Expressions: Complete Guide with Examples 2026

Master cron syntax with clear examples. Learn the 5-field cron format, special characters (*, /, -, ?), and common schedules for Linux crontab, AWS EventBridge, GitHub Actions, and more. Free online cron generator included.

NextUtils Team
10 min read
πŸ“šTutorials
cronautomationlinuxdevopsscheduling
Developer tools and automation experts

Cron is the standard Unix job scheduler β€” and despite being decades old, it remains the backbone of automated task scheduling across Linux servers, cloud services like AWS EventBridge, CI/CD pipelines like GitHub Actions, and container orchestrators like Kubernetes. The five-field cron expression syntax looks cryptic at first (0 9 * * 1-5), but with the right mental model it becomes second nature. This guide demystifies it with 20+ real examples.

The 5-Field Cron Format

*
Minute
0–59
*
Hour
0–23
*
Day of Month
1–31
*
Month
1–12
*
Day of Week
0–6 (Sun=0)
minute hour day-of-month month day-of-week

Each field can contain a specific value, a range, a list, a step, or a wildcard. * * * * * means "every minute of every hour of every day."

Special Characters Explained

CharNameMeaningExample
*WildcardEvery possible value* in hour = every hour
,ListMultiple specific values1,15 in day = 1st and 15th
-RangeFrom–to (inclusive)9-17 in hour = 9 AM to 5 PM
/StepEvery N intervals*/5 in minute = every 5 min
?No Specific ValueUsed in some systems for day fields? in day-of-week (Quartz)
LLastLast day of month or weekL in day = last day of month
#Nth WeekdayThe Nth occurrence in the month2#1 = first Monday (Quartz)
@rebootAliasRun once at startup@reboot (Linux crontab only)

✨ Free Cron Expression Generator

Build cron expressions visually β€” choose your schedule with dropdowns and get the expression automatically. Supports standard Unix cron, Quartz, AWS EventBridge, and more.

Open Cron Generator β†’

20 Essential Cron Expression Examples

Every X Minutes/Hours

*/5 * * * * # Every 5 minutes */15 * * * * # Every 15 minutes 0 * * * * # Every hour (on the hour) 0 */2 * * * # Every 2 hours 0 */6 * * * # Every 6 hours (midnight, 6am, noon, 6pm)

Daily Schedules

0 0 * * * # Every day at midnight (00:00) 0 9 * * * # Every day at 9:00 AM 30 17 * * * # Every day at 5:30 PM 0 0,12 * * * # Twice daily: midnight and noon

Weekday / Weekend Schedules

0 9 * * 1-5 # Weekdays at 9 AM (Mon–Fri) 0 9 * * 1 # Every Monday at 9 AM 0 0 * * 0 # Every Sunday at midnight 0 8 * * 6,0 # Saturday and Sunday at 8 AM 0 9-17 * * 1-5 # Every hour 9–5, weekdays only

Monthly / Specific Dates

0 0 1 * * # 1st day of every month at midnight 0 0 1,15 * * # 1st and 15th of every month 0 0 28-31 * * # Last few days of the month 0 0 * 1 * # Every day in January only 0 0 * */3 * # Every day, every 3rd month (Jan, Apr, Jul, Oct)

Practical Real-World Schedules

0 2 * * * # Daily database backup at 2 AM (low traffic) */10 9-17 * * 1-5 # Every 10 min during business hours 0 9 * * 1 # Weekly report every Monday morning 0 0 1 1 * # Annual job on Jan 1st at midnight 5 4 * * 0 # Weekly cleanup every Sunday at 4:05 AM

Platform Differences: Linux vs AWS vs GitHub Actions

Linux Crontab (5 fields)

# Edit with: crontab -e # MIN HOUR DOM MON DOW 0 9 * * 1-5 /path/to/script.sh
  • Runs in server's local timezone
  • 5 fields only (no seconds)
  • Supports @reboot, @daily, @weekly aliases
  • Output goes to email (set MAILTO= to disable)

AWS EventBridge (6 fields)

# Cron format in EventBridge: # MIN HOUR DOM MON DOW YEAR cron(0 9 ? * MON-FRI *) # Rate expression alternative: rate(5 minutes)
  • Always runs in UTC
  • 6 fields including year
  • Use ? in DOM when DOW is set (and vice versa)
  • Month/day can use names (JAN, MON)

GitHub Actions

# .github/workflows/schedule.yml on: schedule: - cron: '0 9 * * 1-5' # UTC only; min interval: 5 min
  • Always UTC (convert from your local time)
  • Minimum interval: 5 minutes
  • May delay up to 30 min during high load
  • Disabled if no commits for 60 days

Kubernetes CronJob

# manifest.yaml spec: schedule: "0 2 * * *" timeZone: "America/New_York" # K8s 1.27+ jobTemplate: ...
  • 5 fields, standard cron syntax
  • Kubernetes 1.27+: supports timeZone field
  • Older: always UTC (set offset manually)
  • Set concurrencyPolicy for overlap handling

Common Mistakes to Avoid

βœ— Wrong: * 9 * * *βœ“ Right: 0 9 * * *

The first field is minutes, not hours. * in minute position = every minute of the 9 AM hour (60 runs), not once at 9 AM.

βœ— Wrong: 0 9-17 * * *βœ“ Right: 0 9-17 * * 1-5

This runs every hour 9–5, including weekends. Add 1-5 in the day-of-week field for weekdays only.

βœ— Wrong: */60 * * * *βœ“ Right: 0 * * * *

*/60 is invalid (60 > 59 for minutes). Use 0 in the minute field to run on the hour.

βœ— Wrong: 0 9 * * 7βœ“ Right: 0 9 * * 0

Sunday is 0 in standard cron, not 7. Some systems accept both; use 0 for portability.

Quick Reference: Common Schedules

ScheduleCron Expression
Every minute* * * * *
Every 5 minutes*/5 * * * *
Every hour0 * * * *
Every day at midnight0 0 * * *
Every day at 9 AM0 9 * * *
Weekdays at 9 AM0 9 * * 1-5
Every Monday at 8 AM0 8 * * 1
1st of every month0 0 1 * *
Every Sunday at 2 AM0 2 * * 0
Every 15 min during 9-5, weekdays*/15 9-17 * * 1-5
Twice a day (noon + midnight)0 0,12 * * *
Jan 1st at midnight0 0 1 1 *

Tip: Use our Cron Generator to build any expression visually and validate it instantly. It also explains what an existing expression does in plain English.

Share this article

Related Articles

Continue exploring with these related posts

Ready to try our tools?

Explore our collection of free online tools for developers, designers, and power users.

Explore All Tools

Explore More Tools

Discover our collection of free online tools for developers, designers, and power users