Cron Expression Generator

1

Choose Schedule

Select quick pick or customize fields

2

Verify Expression

See human-readable description

3

Copy & Use

Add to your crontab

Cron Expression
* * * * *
Every minute

Quick Picks

Every Minute
* * * * *
Every Hour
0 * * * *
Daily at Midnight
0 0 * * *
Weekdays at 9 AM
0 9 * * 1-5
Monthly (1st)
0 0 1 * *
Weekly (Sunday)
0 0 * * 0

Custom Schedule

Next 5 Run Times

Features

Visual cron expression builder
Quick pick templates
Custom field configuration
Human-readable descriptions
Next run time preview
Copy to clipboard
Download as text file
Syntax validation
100% client-side
No server required

What is a Cron Expression?

A cron expression is a string of five or six fields separated by spaces that represents a schedule for automated tasks. Cron is a time-based job scheduler in Unix-like operating systems. Users schedule jobs (commands or scripts) to run periodically at fixed times, dates, or intervals using cron expressions in crontab files.

Each field in a cron expression specifies when a task should execute: minute, hour, day of month, month, and day of week. Some systems support a sixth field for seconds. Cron expressions use special characters like asterisks (*), commas (,), hyphens (-), and slashes (/) to define complex schedules.

Cron Expression Format

* * * * *
│ │ │ │ │
│ │ │ │ └─ Day of week (0-6, Sunday=0 or 7)
│ │ │ └─── Month (1-12)
│ │ └───── Day of month (1-31)
│ └─────── Hour (0-23)
└───────── Minute (0-59)

Special Characters

How to Use the Cron Generator

Step 1: Choose a Quick Pick

Start with a quick pick template for common schedules like "Every Hour", "Daily at Midnight", or "Weekdays at 9 AM". These templates provide instant cron expressions for typical use cases. Click any quick pick to populate the expression and see the description.

Step 2: Customize Fields

Modify individual fields (minute, hour, day, month, weekday) to create custom schedules. Use asterisks (*) for "any value", numbers for specific values, ranges (1-5), lists (1,3,5), or step values (*/15). The description updates in real-time as you type.

Step 3: Verify Next Run Times

Check the "Next 5 Run Times" section to verify your schedule executes when expected. This preview helps catch mistakes before deploying to production. Ensure the times match your intended schedule.

Step 4: Copy and Deploy

Click "Copy Expression" to copy the cron expression to your clipboard. Add it to your crontab file using `crontab -e` on Linux/Unix systems. The expression is ready to use in any cron-compatible system.

Common Use Cases

1. Automated Backups

Schedule daily or weekly backups of databases, files, and configurations. Use expressions like "0 2 * * *" for daily backups at 2 AM or "0 2 * * 0" for weekly backups on Sunday at 2 AM. Automated backups ensure data safety without manual intervention.

2. Log Rotation and Cleanup

Clean up old log files regularly to save disk space. Schedule cleanup tasks with expressions like "0 0 * * *" for daily cleanup at midnight. Rotate logs weekly or monthly to maintain system performance and comply with retention policies.

3. Data Synchronization

Synchronize data between systems, databases, or cloud services on a schedule. Use expressions like "*/30 * * * *" for every 30 minutes or "0 */4 * * *" for every 4 hours. Regular sync keeps data consistent across systems.

4. Report Generation

Generate and email reports automatically. Schedule daily reports with "0 8 * * 1-5" (weekdays at 8 AM) or monthly reports with "0 9 1 * *" (1st of month at 9 AM). Automated reports save time and ensure stakeholders receive timely information.

5. System Monitoring and Health Checks

Run health checks, monitor system resources, and check service availability periodically. Use expressions like "*/5 * * * *" for every 5 minutes or "*/15 * * * *" for every 15 minutes. Regular monitoring detects issues before they impact users.

Cron Expression Examples

Example 1: Every Minute

* * * * *

Runs every minute of every hour, every day. Useful for high-frequency monitoring or testing.

Example 2: Every Hour

0 * * * *

Runs at minute 0 of every hour (1:00, 2:00, 3:00, etc.). Common for hourly data processing.

Example 3: Daily at Midnight

0 0 * * *

Runs at 00:00 (midnight) every day. Perfect for daily backups, reports, or cleanup tasks.

Example 4: Weekdays at 9 AM

0 9 * * 1-5

Runs at 9:00 AM Monday through Friday. Ideal for business-hours tasks like sending daily reports.

Example 5: Every 15 Minutes

*/15 * * * *

Runs every 15 minutes (00, 15, 30, 45). Good for frequent monitoring or data sync.

Example 6: Monthly on the 1st

0 0 1 * *

Runs at midnight on the 1st day of every month. Used for monthly reports or billing tasks.

Example 7: Weekly on Sunday

0 0 * * 0

Runs at midnight every Sunday. Perfect for weekly backups or maintenance tasks.

Example 8: Every 6 Hours

0 */6 * * *

Runs at 00:00, 06:00, 12:00, and 18:00 every day. Useful for periodic data updates.

Example 9: Twice Daily

0 8,20 * * *

Runs at 8:00 AM and 8:00 PM every day. Good for morning and evening tasks.

Example 10: Business Hours Every 30 Minutes

*/30 9-17 * * 1-5

Runs every 30 minutes from 9 AM to 5 PM on weekdays. Perfect for business-hours monitoring.

Frequently Asked Questions

How do I add a cron job to my system?
On Linux/Unix, run `crontab -e` to edit your crontab file. Add your cron expression followed by the command to execute. Save and exit. The cron daemon will automatically pick up the changes.
What's the difference between day of month and day of week?
Day of month (1-31) specifies calendar dates. Day of week (0-6) specifies days like Monday, Tuesday. If both are specified, the job runs when either condition is met (OR logic, not AND).
Can I run a cron job every 90 minutes?
Cron doesn't directly support intervals that don't divide evenly into 60 minutes. For 90-minute intervals, you'll need multiple cron entries or use a script that tracks last run time.
How do I run a job every 2 hours?
Use `0 */2 * * *` to run at minute 0 of every 2nd hour (00:00, 02:00, 04:00, etc.). The */2 syntax means "every 2 hours".
What does */5 mean in a cron expression?
*/5 means "every 5 units". In the minute field, */5 means every 5 minutes (0, 5, 10, 15, etc.). In the hour field, */5 means every 5 hours.
How do I run a job on the last day of the month?
Standard cron doesn't support "last day of month" directly. Some systems support the L character. Otherwise, use a script that checks if tomorrow is the 1st of the month.
Can I use cron expressions in Windows?
Windows doesn't have cron natively. Use Windows Task Scheduler instead, or install third-party tools like Cygwin. Many applications (Jenkins, Spring, etc.) support cron expressions on Windows.
How do I test my cron expression?
Use this generator to see the human-readable description and next run times. Test with a simple command first (like `echo "test"`). Check system logs (/var/log/cron or /var/log/syslog) to verify execution.
What timezone does cron use?
Cron uses the system's local timezone. Check with `date` command. To use a different timezone, set the TZ environment variable in your crontab or script.
Why isn't my cron job running?
Common issues: incorrect expression syntax, wrong file permissions, command not in PATH, missing environment variables, or cron daemon not running. Check system logs for error messages.

Related Tools

Explore our other DevOps and system administration tools:

💙

Support TechConverter

Get $200 free DigitalOcean credit or sponsor us on GitHub!