What Is Cron?
Cron is a time-based job scheduler found in Unix-like operating systems. It allows you to run commands or scripts automatically at specified times and intervals. From database backups and log rotation to sending scheduled emails and triggering web scrapers, cron is the backbone of task automation on servers worldwide.
At the heart of cron is the cron expression — a compact string that defines exactly when a job should run. Despite its power, the syntax can be intimidating at first glance. A string like 0 */6 * * 1-5 means "every six hours on weekdays," but deciphering that without practice takes effort. This guide breaks down the format so you can build cron expressions with confidence.
The Five-Field Format
A standard cron expression consists of five fields separated by spaces. Each field represents a unit of time:
┌───────────── minute (0 - 59)
│ ┌───────────── hour (0 - 23)
│ │ ┌───────────── day of month (1 - 31)
│ │ │ ┌───────────── month (1 - 12)
│ │ │ │ ┌───────────── day of week (0 - 7, 0 and 7 = Sunday)
│ │ │ │ │
* * * * *Each field can contain a specific value, a range, a list, a step value, or an asterisk (wildcard). The combination of these fields gives you fine-grained control over when your task executes.
Special Characters
Asterisk (*)
The asterisk matches every possible value for a field. For example, * * * * * means "every minute of every hour of every day."
Slash (/)
The slash defines step values. It means "every Nth interval." For example, */15 in the minute field means "every 15 minutes" (at 0, 15, 30, and 45 past the hour). You can combine it with a starting value: 5/15 would run at 5, 20, 35, and 50 minutes past each hour.
Hyphen (-)
The hyphen defines a range. For instance, 1-5 in the day of week field means Monday through Friday. You can combine ranges with steps: 1-5/2 means Monday, Wednesday, and Friday.
Comma (,)
The comma lets you specify a list of values. For example, 1,15 in the day of month field means "on the 1st and 15th of each month." You can mix commas with ranges: 1,5,10-15.
Common Cron Schedules
Here are some of the most frequently used cron expressions:
# Every minute
* * * * *
# Every hour at minute 0
0 * * * *
# Every day at midnight
0 0 * * *
# Every Monday at 9:00 AM
0 9 * * 1
# Every weekday at 8:30 AM
30 8 * * 1-5
# First day of every month at midnight
0 0 1 * *
# Every 15 minutes
*/15 * * * *
# Every 6 hours
0 */6 * * *
# Every Sunday at 2:00 AM (maintenance window)
0 2 * * 0Cron Across Platforms
While the five-field format is the standard, different platforms extend it in various ways. Some systems add a sixth field for seconds (common in Spring Framework and Quartz Scheduler), while others support special strings like @hourly, @daily, and @weekly.
# Platform-specific examples
# GitHub Actions (standard 5-field)
on:
schedule:
- cron: "0 6 * * 1-5"
# AWS CloudWatch Events (6-field with year)
cron(0 12 * * ? *)
# Kubernetes CronJob
schedule: "*/30 * * * *"
# Linux crontab entry
0 3 * * * /usr/local/bin/backup.sh >> /var/log/backup.log 2>&1Always check the documentation for your specific platform to understand which cron features are supported. Some platforms do not allow intervals shorter than one minute, while others may have restrictions on the day of week numbering.
Debugging Cron Expressions
One of the most common issues with cron is that a job does not run when expected. This usually happens because the expression does not mean what you think it does. For example, 0 0 */2 * * runs on odd-numbered days (1, 3, 5, ...), not every two days from today. The step is applied to the range of the field, not relative to the current date.
Using a cron expression tester to preview the next several execution times is the best way to verify your expression before deploying it. Visual confirmation of upcoming run times catches these subtle mistakes immediately.
How to Use the Cron Generator
Open the Cron Generator and follow these steps:
- Enter a cron expression or use the visual editor to select the schedule you want.
- Read the human-readable explanation that describes exactly when the job will run.
- Preview upcoming run times to verify the expression matches your intended schedule.
- Copy the expression and use it in your crontab, CI/CD pipeline, or scheduling service.
The tool supports standard five-field cron syntax and runs entirely in your browser. It is free to use and requires no sign-up.
Ready to build your cron schedule? Open Cron Generator
