Cron Expression Generator
Generate cron expressions visually with a step-by-step builder
Quick presets
Minute
Hour
Day of month
Month
Day of week
Cron expression
0 9 * * *minute hour day(month) month day(week)
What Is a Cron Expression Generator?
A cron expression generator is a tool that builds cron schedule strings through a visual interface instead of requiring you to write them by hand. Cron expressions are five-field strings (minute, hour, day of month, month, day of week) that define when a recurring task should run. The format dates back to the original Unix cron daemon from 1979 and is now used across crontab, Kubernetes CronJobs, GitHub Actions, AWS EventBridge, Google Cloud Scheduler, and dozens of job-scheduling libraries.
Writing cron expressions from memory is a common source of bugs. The five fields interact in non-obvious ways: a step value like */15 in the minute field produces runs at 0, 15, 30, and 45, while 5/15 starts at minute 5 and yields 5, 20, 35, 50. Combining day-of-month and day-of-week with non-wildcard values creates an OR condition, not an AND, which surprises even experienced engineers. A visual generator removes this ambiguity by letting you select the schedule you want and producing the correct syntax automatically.
A cron generator differs from a cron parser. A parser takes an existing expression and explains it in plain language. A generator works in the opposite direction: you describe the schedule you need, and the tool outputs the matching cron string. Use the generator when creating a new scheduled job; use the parser when auditing or debugging existing ones.
Why Use This Cron Generator?
Building a cron expression by hand means memorizing field order, value ranges, and operator rules. A single misplaced field turns a daily job into one that runs every minute. This generator lets you pick your schedule visually and copies the result in one click.
Cron Generator Use Cases
Common Cron Schedule Presets
The table below lists cron expressions for the most frequently used schedules. Most production jobs fall into one of these patterns. Modify individual fields to fit your actual timing.
| Schedule | Expression | Typical use |
|---|---|---|
| Every minute | * * * * * | Health checks, queue polling |
| Every 5 minutes | */5 * * * * | Metrics collection, cache refresh |
| Every 15 minutes | */15 * * * * | API sync, dashboard updates |
| Every hour | 0 * * * * | Log rotation, report generation |
| Every 6 hours | 0 */6 * * * | Database backups, digest emails |
| Daily at midnight | 0 0 * * * | Nightly batch jobs, cleanup scripts |
| Daily at 9 AM | 0 9 * * * | Daily reports, notification digests |
| Weekdays at 9 AM | 0 9 * * 1-5 | Business-hours tasks, standup reminders |
| Every Monday at midnight | 0 0 * * 1 | Weekly reports, dependency updates |
| First of every month | 0 0 1 * * | Billing runs, monthly aggregation |
| Every Sunday at 2:30 AM | 30 2 * * 0 | Full backups during low-traffic window |
| January 1st at midnight | 0 0 1 1 * | Annual reports, license renewals |
Cron Expression Building Blocks
Every cron expression has exactly five fields, read left to right. Each field accepts specific values and operators. Knowing these rules is enough to write any schedule you'd encounter in production.
Four operators control how values are matched within each field. You can combine them: 1-5/2 in the day-of-week field means Monday, Wednesday, Friday (range 1-5, step of 2).
| Operator | Syntax | Example | Produces |
|---|---|---|---|
| Wildcard | * | * (minute) | Every minute |
| List | a,b,c | 1,15 (day) | 1st and 15th |
| Range | a-b | 9-17 (hour) | 9 AM through 5 PM |
| Step | */n | */10 (minute) | Every 10 minutes |
| Range+Step | a-b/n | 10-30/5 (min) | 10, 15, 20, 25, 30 |
Code Examples
How to create and register cron schedules in Node.js, Python, Go, and bash:
import { CronJob } from 'cron';
// Build a cron expression: every weekday at 9:00 AM
const expression = '0 9 * * 1-5';
const job = new CronJob(expression, () => {
console.log('Running weekday morning task');
});
job.start();
// Programmatic expression building
function buildCron({ minute = '*', hour = '*', dom = '*', month = '*', dow = '*' }) {
return `${minute} ${hour} ${dom} ${month} ${dow}`;
}
const expr = buildCron({ minute: '0', hour: '*/6', dow: '1-5' });
console.log(expr); // β "0 */6 * * 1-5"from crontab import CronTab
# Create a new cron job for the current user
cron = CronTab(user=True)
# Build a job: run backup.py every day at 2:30 AM
job = cron.new(command='python3 /home/user/backup.py')
job.setall('30 2 * * *')
print(job) # β 30 2 * * * python3 /home/user/backup.py
print(job.is_valid()) # β True
# Schedule every 15 minutes on weekdays
job2 = cron.new(command='/usr/bin/sync-data')
job2.minute.every(15)
job2.dow.during('MON', 'FRI')
cron.write() # Save to user's crontab
# Verify next run time
from croniter import croniter
from datetime import datetime
it = croniter('30 2 * * *', datetime.now())
print(it.get_next(datetime)) # β next 2:30 AM timestamppackage main
import (
"fmt"
"strings"
"github.com/robfig/cron/v3"
)
// BuildCron constructs a 5-field cron expression from parts
func BuildCron(minute, hour, dom, month, dow string) string {
fields := []string{minute, hour, dom, month, dow}
return strings.Join(fields, " ")
}
func main() {
// Generate: every weekday at 9 AM
expr := BuildCron("0", "9", "*", "*", "1-5")
fmt.Println(expr) // β 0 9 * * 1-5
// Validate and schedule it
c := cron.New()
_, err := c.AddFunc(expr, func() {
fmt.Println("Running scheduled task")
})
if err != nil {
fmt.Printf("Invalid expression: %v\n", err)
return
}
c.Start()
}# Open the crontab editor to add a new job crontab -e # Add a cron job without opening an editor: # Run cleanup.sh every Sunday at 3 AM (crontab -l 2>/dev/null; echo "0 3 * * 0 /home/user/cleanup.sh") | crontab - # Generate and add a job: every 10 minutes, log disk usage EXPR="*/10 * * * *" CMD="df -h >> /var/log/disk-usage.log" (crontab -l 2>/dev/null; echo "$EXPR $CMD") | crontab - # Verify the job was added crontab -l | tail -1 # β */10 * * * * df -h >> /var/log/disk-usage.log # Remove all cron jobs (use with caution) # crontab -r