What is a Cron Expression?
A cron expression is a string of characters that defines a schedule for running automated tasks. Originally developed for Unix-like operating systems, cron expressions are now used across virtually all computing platforms to schedule jobs, scripts, and automated processes.
The name “cron” comes from the Greek word “chronos” meaning time. The cron daemon (crond) on Unix systems reads these expressions and executes commands according to the defined schedule. Today, cron expressions are used in cloud platforms, container orchestration, CI/CD pipelines, and countless other automation contexts.
Understanding Cron Syntax
The 5-Field Format
The standard cron expression consists of five fields separated by spaces:
┌───────────── minute (0-59)
│ ┌───────────── hour (0-23)
│ │ ┌───────────── day of month (1-31)
│ │ │ ┌───────────── month (1-12)
│ │ │ │ ┌───────────── day of week (0-6, Sunday=0)
│ │ │ │ │
* * * * *
Each field accepts specific values within its range, or special characters that define patterns.
Special Characters
Asterisk (*): Matches any value. * * * * * runs every minute.
Comma (,): Lists multiple values. 0 9,17 * * * runs at 9 AM and 5 PM.
Hyphen (-): Defines a range. 0 9 * * 1-5 runs at 9 AM Monday through Friday.
Slash (/): Specifies step values. */15 * * * * runs every 15 minutes.
Extended 6-Field Format
Some systems support an additional seconds field at the beginning:
┌───────────── second (0-59)
│ ┌───────────── minute (0-59)
│ │ ┌───────────── hour (0-23)
│ │ │ ┌───────────── day of month (1-31)
│ │ │ │ ┌───────────── month (1-12)
│ │ │ │ │ ┌───────────── day of week (0-6)
│ │ │ │ │ │
* * * * * *
How to Use This Tool
Select field values: Click on each cron field (Minute, Hour, Day of Month, Month, Day of Week) to expand its options. Choose between “Every”, “Specific”, “Range”, or “Step” modes.
Use presets: Click the Presets button to load common scheduling patterns like “Every hour” or “Weekdays at 9 AM”.
View the expression: Watch your cron expression update in real-time at the top of the tool.
Check next runs: See when your schedule will next execute in the right panel.
Copy and use: Click the copy button to copy the expression for use in your system.
Common Cron Patterns
Every Minute
Expression: * * * * *
Runs once every minute, 24/7.
Every Hour
Expression: 0 * * * *
Runs at the start of every hour (at minute 0).
Every Day at Midnight
Expression: 0 0 * * *
Runs once daily at 00:00.
Every Weekday at 9 AM
Expression: 0 9 * * 1-5
Runs Monday through Friday at 9:00 AM.
First Day of Every Month
Expression: 0 0 1 * *
Runs at midnight on the 1st of each month.
Every Sunday at 9 AM
Expression: 0 9 * * 0
Runs every Sunday at 9:00 AM.
Cron in Different Systems
Unix/Linux crontab
The original cron implementation. Edit with crontab -e and list with crontab -l. Expressions follow the standard 5-field format.
AWS CloudWatch Events
Amazon’s scheduled events use cron expressions with optional year field. Note that AWS uses 6 fields: minute hour day-of-month month day-of-week year.
Kubernetes CronJobs
Kubernetes uses standard 5-field cron expressions for scheduling Jobs. Define in your YAML manifest under spec.schedule.
GitHub Actions
GitHub Actions scheduled workflows use 5-field cron expressions in the on.schedule trigger. Expressions run in UTC timezone.
Docker and Docker Compose
Container scheduling often uses cron expressions with tools like ofelia or in health check intervals.
Best Practices
Test before deploying: Use this tool to verify your expression produces the expected schedule before deploying to production.
Consider timezones: Most cron implementations run in the server’s local timezone or UTC. Verify which timezone your system uses.
Avoid overlapping jobs: Ensure your scheduled jobs complete before the next run starts. Use job locking if overlap is possible.
Log execution: Always log when cron jobs start and finish to assist with debugging and monitoring.
Use descriptive comments: In crontab files, add comments above each entry explaining what the job does.
Handle failures gracefully: Implement error handling and notifications for failed jobs.
Timezone Considerations
Cron expressions don’t include timezone information—they rely on the system’s configured timezone. When scheduling tasks:
- Server time: Traditional cron uses the server’s local time
- UTC: Many cloud platforms (AWS, GitHub Actions) use UTC
- Application time: Some frameworks let you specify timezone per job
Always verify which timezone applies to your cron implementation and adjust your expressions accordingly.
Frequently Asked Questions
What does the asterisk (*) mean?
The asterisk is a wildcard that matches every value in that field. For example, * in the hour field means “every hour”.
How do I run a job every 5 minutes?
Use */5 in the minute field: */5 * * * *. The slash creates a step pattern starting from 0.
Can I specify multiple specific times?
Yes, use commas to list values: 0 9,12,17 * * * runs at 9 AM, noon, and 5 PM.
Why is my cron not running at the expected time?
Check your system’s timezone setting. Also verify the cron daemon is running and your user has permission to schedule jobs.
How do I run a job on the last day of the month?
Standard cron doesn’t support “last day” directly. You can use 0 0 28-31 * * with a script that checks if today is actually the last day.
What’s the difference between day of month and day of week?
Day of month (1-31) specifies calendar dates, while day of week (0-6, Sunday=0) specifies weekdays. If both are set (non-*), most cron implementations run when EITHER condition is met.
Privacy and Security
This cron builder runs entirely in your browser. Your cron expressions are generated locally and never sent to any server. The next run times are calculated using JavaScript’s Date functions on your device.
Start Building
Use the visual builder above to create your cron expression. Select presets for quick starts, or customize each field for precise scheduling control.