Cron expressions tell computers when to run tasks automatically. If you have never written one before, the five-field format looks intimidating — but each field answers one simple question, and you can learn the entire syntax in under 10 minutes.
Every cron expression is five values separated by spaces. Read them left to right:
| Position | Field | Range | Question It Answers |
|---|---|---|---|
| 1st | Minute | 0-59 | At which minute? |
| 2nd | Hour | 0-23 | At which hour? (24-hour clock) |
| 3rd | Day of Month | 1-31 | On which day of the month? |
| 4th | Month | 1-12 | In which month? |
| 5th | Day of Week | 0-6 (0=Sunday) | On which day of the week? |
That is the entire structure. Five questions, five answers. When all five conditions match the current time, your task runs.
Build cron expressions by starting simple and adding specificity:
* * * * * — all five fields are "every value"0 0 * * * — minute 0, hour 0, every day0 9 * * 1 — minute 0, hour 9, any date, any month, MondayNotice the pattern: specific values narrow the schedule, asterisks keep it open.
| Character | Meaning | Example | Result |
|---|---|---|---|
| * | Every value | * * * * * | Every minute |
| / | Step (every Nth) | */5 * * * * | Every 5 minutes |
| - | Range | 0 9-17 * * * | Every hour from 9 AM to 5 PM |
| , | List | 0 9 * * 1,3,5 | 9 AM on Mon, Wed, Fri |
Walk through these examples to see how the fields work together:
Every 5 minutes:
*/5 * * * * — the /5 creates steps of 5 in the minute field. Runs at :00, :05, :10, :15... every hour, every day.Every hour at the 30-minute mark:
30 * * * * — minute 30, every hour. Runs at 12:30, 1:30, 2:30... every day.Every weekday at 9 AM:
0 9 * * 1-5 — minute 0, hour 9, any date, any month, Monday through Friday.Twice a day (9 AM and 5 PM):
0 9,17 * * * — minute 0, hours 9 and 17 (comma creates a list), every day.First of every month at midnight:
0 0 1 * * — minute 0, hour 0, day 1, every month, any day of week.Every 15 minutes during business hours on weekdays:
*/15 9-17 * * 1-5 — every 15 minutes, hours 9-17, any date, any month, Mon-Fri. This combines steps, ranges, and day-of-week filtering in one expression.Skip the manual writing — build cron expressions visually and see the schedule in plain English.
Open Cron GeneratorThis verification step catches the most common mistake: writing an expression that runs far more or less often than you intended.
| Mistake | What You Wrote | What Happens | Correct Expression |
|---|---|---|---|
| Star in minute field | * 9 * * * | Runs every minute from 9:00 to 9:59 (60 times) | 0 9 * * * |
| Wrong day-of-week number | 0 9 * * 7 | Sunday on some systems, error on others | 0 9 * * 0 (Sunday) |
| Both day fields set | 0 9 15 * 1 | Runs on the 15th AND every Monday (OR logic) | Use only one day field |
| Month names misspelled | 0 9 1 Janu * | Error — use JAN or 1 | 0 9 1 1 * or 0 9 1 JAN * |
| 24-hour time confusion | 0 9 * * * (expecting PM) | Runs at 9 AM, not 9 PM | 0 21 * * * (9 PM = hour 21) |
| Forgetting leading zero | 9 * * * * vs 09 | Both work — cron ignores leading zeros | Either format is fine |
| Number | Day | Mnemonic |
|---|---|---|
| 0 | Sunday | Start of week (Unix convention) |
| 1 | Monday | |
| 2 | Tuesday | |
| 3 | Wednesday | |
| 4 | Thursday | |
| 5 | Friday | |
| 6 | Saturday |
Some systems accept 7 for Sunday as well, but 0 is universal. When in doubt, use 0.
Try building these schedules yourself, then verify with the generator:
*/10 * * * *30 15 * * *0 8 * * 2,40 12 1,15 * *0 */6 * * *New to cron? The visual generator builds expressions for you. Just pick a frequency and copy.
Open Cron Generator