Cron Expression Builder & Explainer
How to Use the Cron Expression Builder
Use the visual dropdown inputs to set minute, hour, day of month, month, and day of week for your schedule. Alternatively, click a preset like “Daily at midnight” or “Weekdays at 9am” to start with a common pattern. The tool shows the generated cron expression, a human-readable explanation of the schedule, and the next five scheduled run times so you can verify it works as expected.
Understanding Cron Expression Syntax
Cron expressions define recurring schedules using a compact five-field format. Each field controls one dimension of time, and together they specify exactly when a task should run. The format originated in Unix systems but is now used across virtually every platform that supports scheduled jobs.
The Five Cron Fields
| Field | Allowed Values | Special Characters |
|---|---|---|
| Minute | 0-59 | * , - / |
| Hour | 0-23 | * , - / |
| Day of Month | 1-31 | * , - / |
| Month | 1-12 | * , - / |
| Day of Week | 0-6 (Sun=0) | * , - / |
Special Characters Explained
The asterisk (*) means “every value” for that field. The comma (,) lists specific values, like 1,15 for the 1st and 15th. The hyphen (-) defines ranges, like 1-5 for Monday through Friday. The slash (/) defines intervals, like */10 for every 10th unit.
Common Cron Schedule Examples
These are the most frequently needed cron schedules that developers copy and adapt:
| Expression | Schedule |
|---|---|
0 * * * * | Every hour at minute 0 |
*/15 * * * * | Every 15 minutes |
0 0 * * * | Daily at midnight |
0 9 * * 1-5 | Weekdays at 9:00 AM |
0 0 1 * * | First day of every month |
0 0 * * 0 | Every Sunday at midnight |
30 2 * * * | Daily at 2:30 AM |
0 9,17 * * * | Daily at 9:00 AM and 5:00 PM |
Combining Fields for Complex Schedules
You can combine multiple special characters in a single field. For example, 0 9-17 * * 1-5 runs every hour from 9 AM to 5 PM on weekdays, which is useful for business-hours-only monitoring. The expression 0 0 1,15 * * runs at midnight on the 1st and 15th of every month.
Where Cron Expressions Are Used
Cron expressions appear in many contexts beyond traditional Unix crontab files. CI/CD pipelines use them to trigger scheduled builds. Cloud platforms use them for serverless function scheduling. Kubernetes CronJobs use them to run containers on a schedule. Database maintenance scripts, log rotation, backup jobs, and monitoring checks all rely on cron scheduling.
Each platform may have slight variations in syntax. GitHub Actions and AWS EventBridge use the same five-field format but may add extra fields. Always verify the next run times shown by this tool against your platform’s documentation.
Avoiding Common Cron Mistakes
One of the most frequent mistakes is confusing the hour field with a 12-hour clock. Cron uses 24-hour time, so 2 PM is hour 14, not 2. Another common error is setting both day-of-month and day-of-week, which creates an OR condition in standard cron (the job runs when either field matches) rather than an AND condition.
When testing schedules for tasks that deal with timestamps, the Unix Timestamp Converter helps you verify times and dates. For validating the pattern syntax itself, the Regex Tester can help you build patterns that parse cron expressions in your application code.
Related Tools
- Unix Timestamp Converter - Convert between timestamps and human-readable dates
- Regex Tester - Test patterns for parsing cron expressions
- JSON / YAML / TOML Converter - Convert configuration files containing cron schedules
Frequently Asked Questions
What does a cron expression look like?
A standard cron expression has five fields separated by spaces: minute (0-59), hour (0-23), day of month (1-31), month (1-12), and day of week (0-6). For example, '0 9 * * 1-5' means every weekday at 9:00 AM. Asterisks mean 'every value' for that field.
How do I schedule a cron job to run every 5 minutes?
Use the expression */5 * * * * which means every 5th minute, every hour, every day. The */5 syntax in the minute field tells cron to run at minutes 0, 5, 10, 15, and so on throughout each hour.
What is the difference between cron and crontab?
Cron is the scheduling daemon that runs tasks at specified times. Crontab (cron table) is the file or command used to define those scheduled tasks. You edit the crontab to add, modify, or remove cron jobs that the cron daemon executes.
Do cloud services use the same cron format?
Most cloud services like AWS CloudWatch, Google Cloud Scheduler, and GitHub Actions use the standard five-field cron format. Some services add a sixth field for seconds or year. AWS also supports a rate expression syntax as an alternative to cron.