Next 5 Execution Times
Common Cron Expressions Cheat Sheet
| Expression | Description |
|---|---|
| * * * * * | Every minute |
| */5 * * * * | Every 5 minutes |
| 0 * * * * | Every hour |
| 0 0 * * * | Daily at midnight |
| 0 9 * * 1 | Every Monday at 9AM |
| 0 0 1 * * | 1st of every month |
| 0 0 * * 1-5 | Every weekday at midnight |
| 0 0,12 * * * | Twice daily (midnight & noon) |
| 0 0 1 1 * | Every January 1st |
| 0 0 * * 0 | Every Sunday at midnight |
| 0 0 L * * | Last day of every month |
| 0 0 1-7 * 1 | First Monday of every month |
Tutorial
This Cron expression generator provides visual editing and real-time preview. Here's how to use it:
Select Format: The top of the page offers three format options: 5-field (standard Linux crontab), 6-field (with seconds, for Spring/Quartz), and 7-field (with year). Choose the format that matches your target scheduling system — the input area automatically adjusts the number of fields.
Visual Editing: Each Cron field (seconds, minutes, hours, day, month, weekday, year) has its own editing panel. You can directly type values, check multiple values, or use quick actions (select all, clear, invert). For example, checking 0, 15, 30, 45 in the "Minutes" field creates a schedule that runs every 15 minutes. The valid range is displayed below each field, and out-of-range values are highlighted in red.
Presets & Cheat Sheet: Click preset buttons to quickly load common expressions (e.g., "every minute," "daily at midnight," "every Monday"). The cheat sheet below lists the most common expressions with their meanings — click any row to load it into the editor.
Execution Preview: After editing, the preview table shows the next 5 execution times and their relative distances. If the expression is invalid, an error message appears. Once confirmed, click the copy button to copy the expression to your clipboard. The tool also generates a human-readable explanation, for example translating 0 9 * * 1-5 into "At 09:00, Monday through Friday."
Use Cases
Cron expressions are the universal language for scheduled task management. Here are key scenarios:
Linux System Administration: On Linux/Unix servers, crontab is the standard tool for managing recurring tasks. Sysadmins use Cron expressions for log rotation, data backups, system monitoring, and temp file cleanup. For example, 0 2 * * * runs a backup script daily at 2 AM.
Backend Service Development: Frameworks like Spring's @Scheduled annotation, Quartz Scheduler, and Elastic-Job all use Cron expressions. Developers need precise control over task timing, such as 0 0 9 * * MON for weekly reports every Monday at 9 AM, or 0 0 0 1 * ? for monthly settlement on the 1st at midnight.
Cloud-Native & DevOps: Kubernetes CronJob uses Cron expressions to schedule cluster tasks like data synchronization and resource cleanup. CI/CD pipelines (GitLab CI scheduled pipelines, Jenkins timed builds) also rely on Cron expressions to trigger automated workflows.
Extended Knowledge
Origin of Cron: The name "Cron" comes from the Greek word "Chronos" (time). It was originally introduced at Bell Labs in Unix V7 around 1975. Initially supporting only 5 fields, the format gradually expanded to 6 fields (seconds) and 7 fields (year) with frameworks like Spring and Quartz.
Special Characters: Beyond the basic * (any), , (list), - (range), and / (step), some implementations support ? (no specific value, for day/weekday mutual exclusion), L (last, e.g., 0 0 L * * for the last day of month), W (nearest weekday), and # (nth occurrence, e.g., 0 0 0 ? * 2#1 for the first Monday of the month).
Implementation Differences: Different systems parse Cron differently. Linux crontab uses 5 fields with day-of-month and weekday in an "OR" relationship; Quartz uses 6-7 fields with an "AND" relationship (requiring ?); Spring's CronSequenceGenerator requires 6 fields where both 0 and 7 represent Sunday. Always consult your target system's documentation.
FAQ
What is a Cron expression?
A Cron expression is a string format used to define when scheduled tasks should run. It is widely used in Linux crontab, Spring Scheduler, Quartz, Kubernetes CronJob, and many other scheduling systems. It consists of 5 or 6 fields representing minute, hour, day of month, month, day of week (and optionally seconds and year).
What do the Cron expression fields mean?
Standard 5-field format is "min hour day month weekday". 6-field adds "seconds" at the beginning. 7-field adds "year" at the end. Special characters include: * (any), , (list), - (range), / (step). For example, "*/5" means every 5 units.
How do I preview execution times?
After entering or editing a Cron expression in this tool, the "Next 5 Execution Times" section will display the next 5 trigger times in real-time, helping you verify the expression matches your expectations. Each time shows how long until it runs.
What is the difference between 5-field and 6-field Cron?
5-field Cron is the Unix/Linux standard (min hour day month weekday). 6-field Cron adds a "seconds" field at the start (sec min hour day month weekday), commonly used in Spring and Quartz. If your system doesn't support seconds, use the 5-field format.
Why might day-of-month and day-of-week not work as expected together?
In most Cron implementations, day-of-month and day-of-week are "OR" conditions, not "AND". That means the task runs if either condition is met. To require both, some systems (like Quartz) support the "?" placeholder. It's recommended to set one field and use * for the other.
What is the smallest interval Cron supports?
Standard 5-field Cron has a minimum interval of 1 minute. With 6-field format (including seconds), the minimum can be 1 second. However, the actual minimum also depends on the scheduler implementation — Linux crontab supports minute-level, while Java Quartz and Spring Task support second-level scheduling.