Cron Expression Generator: The Complete Guide to Cron Jobs (2026)
Table of Contents
Cron is the backbone of task automation in Unix-like systems. Named after the Greek word "chronos" (time), cron has been scheduling jobs reliably since the 1970s. Today, cron expressions power everything from simple backup scripts to complex distributed systems running on Kubernetes and cloud platforms.
Our free Cron Expression Generator helps you build, understand, and validate cron expressions visually. Whether you're a DevOps engineer managing hundreds of scheduled jobs or a developer setting up your first automated task, this comprehensive guide covers everything you need to know about cron.
Cron Syntax Explained
A standard cron expression consists of five fields separated by spaces. Each field represents a unit of time:
# Standard 5-field cron expression
+------------- minute (0-59)
� +------------- hour (0-23)
� � +------------- day of month (1-31)
� � � +------------- month (1-12)
� � � � +------------- day of week (0-6, Sun=0)
� � � � �
* * * * * command to execute
The Five Fields in Detail
1. Minute (0-59)
Specifies which minute of the hour the job runs. 0 means at the top of the hour,
30 means at half past.
2. Hour (0-23)
Uses 24-hour format. 0 is midnight, 12 is noon, 23 is 11 PM.
3. Day of Month (1-31)
The calendar day. Be careful with values like 31�months with fewer days will skip execution.
4. Month (1-12)
January is 1, December is 12. Some systems accept three-letter abbreviations (JAN, FEB, etc.).
5. Day of Week (0-6)
Sunday is typically 0, Saturday is 6. Some systems also accept 7 for Sunday. Three-letter abbreviations (SUN, MON) often work too.
Day of Month vs Day of Week
When both day-of-month and day-of-week are specified (not *), most cron implementations run on EITHER matching day�it's an OR condition, not AND. This catches many developers by surprise!
Special Characters
Asterisk (*) � Any Value
* * * * * runs every minute because * matches all possible values in each field.
Comma (,) � List of Values
0,15,30,45 * * * * runs at minutes 0, 15, 30, and 45 of every hour (four times per hour).
Hyphen (-) � Range of Values
0 9-17 * * * runs at the top of every hour from 9 AM to 5 PM (business hours).
Slash (/) � Step Values
*/5 * * * * runs every 5 minutes. The slash means "every Nth value."
# Every 15 minutes
*/15 * * * *
# Every hour at minute 30
30 * * * *
# Every weekday at 9 AM
0 9 * * 1-5
# First day of every month at midnight
0 0 1 * *
# Every Sunday at 2:30 AM
30 2 * * 0
Build Your Cron Expression
Use our visual generator with real-time preview and next run times.
Open Cron Generator ?Common Cron Expression Examples
System Maintenance
0 2 * * *� Daily at 2 AM (perfect for backups)0 0 * * 0� Weekly on Sunday midnight (weekly cleanup)0 0 1 * *� Monthly on the 1st at midnight
Business Schedules
0 9 * * 1-5� Weekdays at 9 AM (daily standup reminder)0 18 * * 5� Every Friday at 6 PM (weekly report)0 0 1,15 * *� 1st and 15th of month (payroll)
Development & DevOps
*/5 * * * *� Every 5 minutes (health checks)0 */4 * * *� Every 4 hours (sync jobs)0 3 * * *� Daily at 3 AM (CI/CD nightly builds)
Cron on Different Platforms
Linux/Unix Crontab
The classic implementation. Edit with crontab -e. Each user can have their own crontab, plus
system-wide jobs in /etc/crontab.
Kubernetes CronJobs
K8s uses standard cron syntax in the schedule field. The job creates a Pod on schedule:
apiVersion: batch/v1
kind: CronJob
metadata:
name: backup-job
spec:
schedule: "0 2 * * *"
jobTemplate:
# ... job spec
GitHub Actions
GitHub uses cron in workflow triggers. Note: minimum interval is 5 minutes, and scheduled runs may be delayed during high load.
AWS CloudWatch Events / EventBridge
AWS uses a slightly different syntax with an optional 6th field for year, and supports ? for
"no specific value."
Best Practices for Cron Jobs
1. Use Descriptive Comments
Always add a comment above your cron entry explaining what it does:
# Backup database to S3 every night at 2 AM
0 2 * * * /opt/scripts/backup-db.sh
# Clear temp files older than 7 days
0 4 * * 0 find /tmp -mtime +7 -delete
2. Capture Output and Errors
Redirect stdout and stderr to log files for debugging:
0 2 * * * /opt/scripts/backup.sh >> /var/log/backup.log 2>&1
3. Use Lock Files to Prevent Overlap
For long-running jobs, use flock to prevent multiple instances:
*/5 * * * * flock -n /tmp/job.lock /opt/scripts/long-job.sh
4. Set Appropriate Environment Variables
Cron runs with a minimal environment. Define PATH and other vars at the top of your crontab.
5. Consider Timezone
Cron typically uses the system timezone. For distributed systems, consider using UTC to avoid confusion.
Debugging Cron Jobs
Check Cron Logs
On most systems: /var/log/cron or /var/log/syslog. Use
grep CRON /var/log/syslog to filter.
Verify Syntax
Use our generator to validate your expression and see exactly when it will run next.
Test Command Manually
Run your command directly in a shell first. Remember cron has a minimal environment�use full paths!
Check Permissions
Ensure the script is executable (chmod +x script.sh) and the cron user has permission to run
it.
Frequently Asked Questions
What does * * * * * mean?
Five asterisks means "run every minute of every hour of every day of every month on every day of the week." In other words, the job runs continuously, once per minute, 24/7. This equals 1,440 executions per day.
How do I run a cron job every 5 minutes?
Use the step syntax: */5 * * * *. This runs at minutes 0, 5, 10, 15, 20, 25, 30,
35, 40, 45, 50, and 55 of every hour.
What's the difference between 5-field and 6-field cron?
Standard Unix cron uses 5 fields (minute to day-of-week). Some systems add a 6th field � either for seconds (at the beginning) or year (at the end). Our generator uses the universal 5-field format that works everywhere.
Is Sunday 0 or 7 in cron?
In the POSIX standard, Sunday is 0 and Saturday is 6. However, many implementations also accept 7 as Sunday for convenience. Our generator uses 0 for Sunday to ensure maximum compatibility.
Why didn't my cron job run?
Common causes: (1) Incorrect cron syntax � validate with our generator.
(2) PATH issues � use absolute paths. (3) Permission
problems � check file permissions. (4) Script errors � test manually first.
(5) Cron daemon not running � check with
systemctl status cron.
Can cron run every second?
Standard 5-field cron's minimum granularity is one minute. For sub-minute
scheduling, use a 6-field cron (if your platform supports it), or run a script every minute
that executes multiple times with sleep commands.
Is this cron generator secure?
Absolutely. All processing happens 100% client-side in your browser using JavaScript. Your cron expressions never leave your device�we have no servers receiving your data. You can verify this in your browser's Network tab.
Code Formatter � 2026. Professional developer tools built with privacy and performance in mind.