What is a Cron Expression?
A cron expression is a string consisting of five fields separated by spaces that represents a schedule. Cron expressions are used in Unix-like operating systems to schedule commands or scripts to run automatically at specified intervals. The name "cron" comes from the Greek word "chronos" meaning time. System administrators and developers rely on cron jobs for tasks like database backups, log rotation, sending scheduled emails, and running periodic maintenance scripts.
Cron Expression Syntax Guide
A standard cron expression has five fields. Each field can contain specific values, wildcards, ranges, intervals, or lists. Understanding the syntax is essential for creating accurate schedules for your automated tasks and cron jobs.
| Field | Allowed Values | Special Characters | Description |
|---|---|---|---|
| Minute | 0-59 | * , - / | The minute of the hour when the command runs |
| Hour | 0-23 | * , - / | The hour of the day (0 = midnight, 23 = 11 PM) |
| Day of Month | 1-31 | * , - / | The day of the month when the command runs |
| Month | 1-12 | * , - / | The month of the year (1 = January, 12 = December) |
| Day of Week | 0-7 | * , - / | The day of the week (0 and 7 = Sunday, 1 = Monday) |
Special Characters in Cron
* (Asterisk)
Matches every possible value for the field. For example, *in the hour field means "every hour."
, (Comma)
Specifies a list of values. For example, 1,3,5 in the day-of-week field means Monday, Wednesday, and Friday.
- (Hyphen)
Defines a range of values. For example, 9-17 in the hour field means every hour from 9 AM to 5 PM.
/ (Slash)
Specifies step values. For example, */15in the minute field means "every 15 minutes."
Common Cron Expression Examples
| Expression | Description |
|---|---|
| * * * * * | Every minute |
| */5 * * * * | Every 5 minutes |
| 0 * * * * | Every hour (at minute 0) |
| 0 0 * * * | Every day at midnight |
| 0 9 * * 1-5 | Every weekday at 9:00 AM |
| 0 0 1 * * | First day of every month at midnight |
| 0 0 * * 0 | Every Sunday at midnight |
| 30 4 1,15 * * | At 4:30 AM on the 1st and 15th of every month |
| 0 22 * * 1-5 | Every weekday at 10:00 PM |
| 0 0 1 1 * | Once a year on January 1st at midnight |
How to Use This Cron Generator
This free online cron expression generator helps you build and understand cron schedules without memorizing the syntax. Use the visual builder to select values for each field, or choose from common presets to get started quickly. The tool instantly shows a human-readable explanation of your cron expression, calculates the next five execution times, and displays a visual timeline of when your job will fire throughout the day. You can also paste any existing cron expression into the explainer to get an instant plain-English description.
Whether you are setting up a crontab on a Linux server, configuring a scheduled task in a CI/CD pipeline, or defining a cron trigger for a cloud function, this tool makes it easy to get the expression right the first time. The generated cron expressions are compatible with standard Unix cron, AWS CloudWatch Events, Google Cloud Scheduler, GitHub Actions, and most other platforms that support cron syntax.
Tips for Writing Cron Expressions
- Always verify your cron expression by checking the next scheduled runs before deploying it to production.
- Remember that both 0 and 7 represent Sunday in the day-of-week field.
- When both day-of-month and day-of-week are specified, the job runs when either condition is met (OR logic).
- Use step values (/) for evenly spaced intervals instead of listing individual values.
- Be careful with timezone differences — cron typically runs in the system's local timezone unless configured otherwise.
- Avoid scheduling resource-intensive jobs at common times like midnight or the top of the hour to prevent contention.