Cron Expressions Explained: The Complete 2026 Syntax Guide
A cron expression is a string of five or six fields separated by spaces that represents a schedule to execute a routine task. The fields represent minute, hour, day of the month, month, and day of the week.
If you just need to generate or decipher a schedule right now, use our free visual tools:
- 👉 Cron Generator: Build complex cron schedules with a UI.
- 👉 Cron Explainer: Translate any existing cron string into plain English.
By understanding the architecture of temporal automation, DevOps engineers ensure strict background job execution across Unix-like environments, Kubernetes CronJobs, and AWS EventBridge.
The Standard Cron Syntax (5 Fields)
In modern systems architecture, the cron daemon (crond) evaluates the crontab mapping specific execution timestamps to shell commands. The standard Unix 5-field syntax (Vixie Cron, Cronie) is the default for most Linux distributions and Kubernetes endpoints.
| Field Name | Mandatory | Allowed Values | Allowed Special Characters |
|---|---|---|---|
| Minute | Yes | 0–59 | * , - / |
| Hour | Yes | 0–23 | * , - / |
| Day of Month | Yes | 1–31 | * , - / |
| Month | Yes | 1–12 or JAN–DEC | * , - / |
| Day of Week | Yes | 0–7 or SUN–SAT | * , - / |
Note: In standard Unix cron, both 0 and 7 represent Sunday. However, in enterprise dialects (Quartz, AWS, EventBridge), the range is strictly 1–7, where 1 is Sunday.
Extended Dialects (6 and 7 Fields)
For high-frequency polling and one-time executions, enterprise schedulers like Quartz and AWS EventBridge extend the syntax:
| Position | Field Name | Allowed Values | Notes |
|---|---|---|---|
| 1 | Seconds | 0–59 | Mandatory in Quartz. |
| 2–6 | (Standard) | (See Above) | Accepts ? L W # |
| 7 | Year | 1970–2099 | Optional in Quartz, Mandatory in AWS |
For configuring serverless functions like AWS EventBridge or Vercel Crons, ensure your JSON Formatter validates the JSON configurations perfectly to avoid syntax deployment failures.
Special Characters Explained
Operators allow a single field to represent a range, list, or step-function of time points.
Core Operators
- Asterisk (
*): The "all values" wildcard. An asterisk in the Hour field means the job triggers every hour. - Comma (
,): A list separator for discrete values (e.g.,MON,WED,FRI). - Hyphen (
-): Defines an inclusive range (e.g.,9-17triggers every hour from 9 AM to 5 PM). - Slash (
/): Specifies increments or "step" values (e.g.,*/15triggers at 0, 15, 30, and 45 minutes).
Advanced Logic Operators
- Question Mark (
?): Indicates "no specific value." Mandatory in AWS EventBridge and Quartz when specifying either Day of Month or Day of Week. - Last (
L): Targets the final day.Lin Day of Month means the very last day of the month. - Weekday (
W): Targets the nearest weekday (Mon–Fri).15Wfires on the weekday closest to the 15th. - Hash (
#): Specifies the "nth" occurrence of a weekday.6#3triggers on the third Friday.
Not sure if your syntax uses standard or advanced operators? Validate it using our Cron Explainer.
10 Common Cron Examples
Below are production-ready examples highlighting differences between Standard Unix and Enterprise dialects.
| Cron Expression | Dialect | Meaning | DevOps Use Case |
|---|---|---|---|
*/5 * * * * | Standard | Every 5 minutes. | High-frequency health checks. |
0 * * * * | Standard | Every hour at minute 0. | Periodic log rotation. |
0 9 * * 1-5 | Standard | 9:00 AM every weekday. | Automated daily stand-up notifications. |
0 0 1 * * | Standard | Midnight on the 1st of every month. | Monthly backup consolidation. |
0 2 * * 0 | Standard | 2:00 AM every Sunday. | Weekly database vacuuming. |
0 0/15 9-17 ? * MON-FRI | Quartz | Every 15 minutes during business hours. | CI/CD pipeline syncing. |
0 59 23 L-3 * ? | Quartz | 11:59 PM on the third-to-last day of the month. | Pre-emptive financial processing. |
0 15 10 ? * 6L | Quartz | 10:15 AM on the last Friday of every month. | Compliance audit triggers. |
0 0 12 1/5 * ? | Quartz | 12:00 PM every 5 days. | Distributed cleanup of staging environments. |
15 10 * * ? 2025 | AWS | 10:15 AM every day, only in 2025. | Time-bound migration window. |
Generate any of these instantly for your specific framework using the Cron Generator.
Common Mistakes Developers Make
Cron failures frequently stem from the gap between interactive shells and non-interactive daemon execution.
- The Environment Gap: Cron executes with a bare-bones environment, ignoring
/etc/profileand defaulting to a minimalPATH. Solution: Recommend using absolute paths like/usr/local/bin/python3to ensure portability. - Relative vs. Absolute Paths: Using relative paths is a high-risk failure point. Mandate absolute paths for all script locations.
- The Day-Field Conflict: In AWS and Quartz, you cannot specify both a Day of Month and Day of Week. Use
?in one of those fields. - Daylight Saving Time (DST) Anomalies: A job scheduled at 2:30 AM will be skipped during "Spring Forward" and executed twice during "Fall Back" on local time. Standard: All production cron servers must run on UTC.
- Silent Failures: Cron provides no native logging of exit codes. Requirement: Redirect output (
>> /var/log/cron.log 2>&1) and implement active heartbeat monitoring.
Architectural Best Practices
- Standardize all infrastructure on UTC.
- Use locking utilities (like
flock) to prevent overlapping runs. - Source environments via wrapper scripts
SHELL=/bin/bashinstead of one-liners. - Design for idempotency.
FAQ
What does * * * * * mean in cron?
* * * * * is the standard cron expression for "every minute." It tells the cron daemon to execute the command at the 0th second of every minute, every hour, every day of the month, every month, and every day of the week.
How do I run a cron job every 5 minutes?
To run a cron job every 5 minutes, use the slash operator to specify the step value in the minute field: */5 * * * *. This executes at minutes 0, 5, 10, 15, and so on.
Does cron support seconds?
Standard Unix cron (Vixie, Cronie) does not support seconds and evaluates schedules at a minimum granularity of one minute. However, enterprise dialects like Quartz Scheduler and Spring Framework extend the syntax to 6 fields, placing Seconds as the first field (0–59).