Cron Expressions Explained: Schedule Like a Pro
Cron expressions are the backbone of scheduled task automation across Linux servers, CI/CD pipelines, and cloud platforms. Despite their power, the compact syntax trips up even experienced developers. This guide breaks down every component so you can write cron schedules with confidence.
The 5-Field Format
A standard cron expression consists of five fields separated by spaces. From left to right they represent: minute (0-59), hour (0-23), day of month (1-31), month (1-12), and day of week (0-6, where 0 is Sunday). Each field accepts a number, a range, a list, or a wildcard.
Special Characters
*— matches every possible value for that field.,— separates a list of values, e.g.1,15for the 1st and 15th.-— defines a range, e.g.9-17for business hours./— sets a step value, e.g.*/5for every 5 units.
Common Schedules You Should Know
Here are cron expressions developers reach for most often:
0 * * * *— every hour on the hour. Great for cache refreshes.0 9 * * 1-5— weekdays at 9 AM. Perfect for daily reports.*/15 * * * *— every 15 minutes. Useful for health checks.0 0 1 * *— midnight on the first of each month. Ideal for billing jobs.0 2 * * 0— 2 AM every Sunday. A classic maintenance window.
Gotchas and Tips
The most common mistake is confusing day-of-month and day-of-week fields. When both are set to non-wildcard values, most cron implementations run the job if either condition matches, not both. This catches many people off guard.
Timezone awareness is another frequent source of bugs. Cron typically uses the server system timezone, not UTC. When deploying to cloud environments, verify which timezone your scheduler expects. Many CI/CD platforms like GitHub Actions default to UTC, while your local crontab uses your machine timezone.
Always test your expressions before deploying. A misplaced value can mean a job runs every minute instead of every month, potentially overwhelming your database or racking up API costs.
Try It Yourself
Stop guessing whether your cron expression is correct. Use our interactive cron parser to validate your schedules instantly and see the next execution times in plain English.
Try Septim Forge Pro
22 developer tools, all running in your browser. Pro unlocks advanced tools for a one-time $9.
Get Pro — $9 Lifetime