Cron Expression Guide: Fields, Syntax and Run-Time Examples
Field-by-field cron expression reference with next-run times checked in code, the day-of-month OR trap, dialect differences (Unix, Quartz, GitHub, Kubernetes) and common errors.
On this page ⌄
- The five fields
- Next run times, computed
- The day-of-month and day-of-week trap
- Sunday is 0 or 7 (and Quartz is different)
- Which dialect are you writing?
- Common mistakes
- What a cron expression is, in one paragraph
- Common schedules: expression, plain English and next runs
- What each scheduler accepts, from its own documentation
- Check the syntax before you deploy
- Quick answers
- Tested
- FAQ
A cron expression is a schedule written as five space-separated fields. Most of the confusion around it comes from three things: which characters your scheduler actually accepts, how the two day fields interact, and what time zone the clock uses. This page covers all three, with next-run times that were computed rather than guessed.
To try any expression below, paste it into the Cron Builder, which explains it in plain English and lists the next five runs.
The five fields
┌───────────── minute 0-59
│ ┌─────────── hour 0-23
│ │ ┌───────── day of month 1-31
│ │ │ ┌─────── month 1-12 or jan-dec
│ │ │ │ ┌───── day of week 0-7 or sun-sat (0 and 7 are both Sunday)
│ │ │ │ │
* * * * *
The Debian/Ubuntu crontab(5) page confirms the ranges, the month and weekday names, and that "0 or 7 is Sun". All of the following are valid in a field:
| Syntax | Meaning | Example | Reads as |
|---|---|---|---|
* | every value | * * * * * | every minute |
5 | one value | 5 * * * * | minute 5 of every hour |
1,15 | list | 0 0 1,15 * * | midnight on the 1st and 15th |
1-5 | inclusive range | 0 9 * * 1-5 | 09:00, Monday to Friday |
*/15 | step over the full range | */15 * * * * | minutes 0, 15, 30, 45 |
9-17/4 | step inside a range | 30 9-17/4 * * 1-5 | 09:30, 13:30, 17:30 on weekdays |
mon-fri | names (3 letters) | 0 12 * * mon-fri | noon on weekdays |
Next run times, computed
Each row below was evaluated with Python croniter 6.2.4, starting from Monday 2026-11-02 10:07 UTC. The times are what a UTC scheduler would do.
| Expression | Next runs |
|---|---|
*/5 * * * * | 10:10, 10:15, 10:20, 10:25, 10:30 |
*/15 * * * * | 10:15, 10:30, 10:45, 11:00, 11:15 |
*/3 * * * * | 10:09, 10:12, 10:15, 10:18, 10:21 |
0 */6 * * * | 12:00, 18:00, then 00:00, 06:00, 12:00 next day |
30 9-17/4 * * 1-5 | 13:30, 17:30 today, then 09:30, 13:30, 17:30 on Tuesday |
0 9 * * 1-5 | Tue 11-03, Wed 11-04, Thu 11-05, Fri 11-06, Mon 11-09, all 09:00 |
0 0 * * 0 | Sundays: 11-08, 11-15, 11-22, 11-29, 12-06 |
0 0 1 * * | 12-01, 2027-01-01, 02-01, 03-01, 04-01 |
0 0 1 */3 * | 2027-01-01, 04-01, 07-01, 10-01, 2028-01-01 |
0 0 1,15 * * | 11-15, 12-01, 12-15, 2027-01-01, 01-15 |
0 0 31 * * | 12-31, 2027-01-31, 03-31, 05-31, 07-31 |
0 0 29 2 * | 2028-02-29, 2032, 2036, 2040, 2044 |
Two things worth noticing. */3 * * * * does not fire every three minutes from "now": it fires on minutes 0, 3, 6 and so on, so 10:09 comes first. And 0 0 31 * * skips every month with fewer than 31 days: the fifth run is already in July 2027, almost nine months out.
A step also restarts at 0 each hour. A step that does not divide 60 gives an uneven gap: */7 * * * * fires at minute 56 and then at minute 0, only four minutes later.
The day-of-month and day-of-week trap
When both day fields are restricted (neither is *), classic cron runs the job when either one matches. The Ubuntu man page states it: "the command will be run when either field matches the current time". croniter agrees:
0 0 1 * 1 -> Mon 11-09, Mon 11-16, Mon 11-23, Mon 11-30, Tue 12-01
That is every Monday plus the 1st of the month, not "Monday the 1st". The list ends on Tuesday 12-01 because the 1st matched on its own.
To get "the first Monday of the month" with standard cron, restrict the day of week and test the date inside the job:
0 9 * * 1 [ "$(date +\%d)" -le 7 ] && /usr/local/bin/monthly-report
The % must be escaped as \% in a crontab line. The date logic was checked with GNU date: 2026-12-07 and 2027-01-04 (both Mondays) pass the -le 7 test, 2026-12-14 does not.
The same trick handles "last day of month". Run on days 28 to 31 and test whether tomorrow is the 1st:
0 0 28-31 * * [ "$(date -d tomorrow +\%d)" = 01 ] && /usr/local/bin/month-end
Checked with date -d "<day> +1 day": it returns 01 for 2026-11-30, 2026-12-31, 2027-02-28 and 2028-02-29, and 30 or 29 for the days before them. The date arithmetic was tested, not a live cron daemon.
One implementation detail from the man page: Vixie-derived cron only checks whether the first character of a day field is *. So 0 0 */2 * sun runs "every Sunday that's an uneven date" (an AND), while croniter treats the same line as an OR (it returned Tue 11-03, Thu 11-05, Sat 11-07, Sun 11-08). Libraries disagree on this edge, so avoid mixing a stepped day field with a day-of-week field.
Sunday is 0 or 7 (and Quartz is different)
In Vixie cron, 0 and 7 both mean Sunday; croniter returned identical Sunday runs for 0 0 * * 0 and 0 0 * * 7. Quartz numbers days 1 to 7 starting at Sunday, so 1 there is Sunday, not Monday. If you port a schedule between systems, use names (mon-fri) wherever the scheduler accepts them.
Which dialect are you writing?
| Scheduler | Fields | Time zone | Notes |
|---|---|---|---|
| Linux/Unix cron | 5 | server local time | no L, # or ? in the man page |
| GitHub Actions | 5 | UTC by default, optional IANA timezone per schedule | operators *, ,, -, / only (GitHub docs); minimum interval 5 minutes. See GitHub Actions schedules |
| Kubernetes CronJob | 5 | controller-manager zone, or spec.timeZone | CRON_TZ= inside the schedule is rejected. |
| Quartz / Spring | 6 or 7 (leading seconds, optional year) | configurable | ?, L, W, # available |
| AWS EventBridge rules | 6 (adds year, no seconds) | UTC | one of the two day fields must be ? |
The Quartz and EventBridge rows come from those products' documentation; neither scheduler was run. The Linux, GitHub and Kubernetes rows come from the Ubuntu man page and the official docs.
To convert a Quartz line such as 0 0 12 * * ? to standard cron, drop the seconds field and turn ? into *, which gives 0 12 * * *.
Extensions you cannot rely on
L (last), # (nth weekday) and W are not part of standard cron. croniter accepts some of them, so a Python test can pass for an expression your real scheduler rejects:
0 0 L * * -> 11-30, 12-31, 2027-01-31, 02-28, 03-31
0 9 * * 1#1 -> Mon 12-07, 2027-01-04, 02-01, 03-01, 04-05 (first Mondays)
0 0 * * 5L -> error: CroniterNotAlphaError
Those results describe croniter only; they are not evidence that cron, GitHub Actions or Kubernetes will accept the syntax. Validate against the scheduler you deploy to.
Common mistakes
| You wrote | What happens |
|---|---|
* 9 * * * | runs every minute from 09:00 to 09:59 (60 times), not once at 09:00. Use 0 9 * * * |
0 0 31 * * | silently skipped in 30-day months and February |
0 0 1 * 1 | OR rule: 1st of month plus every Monday |
60 * * * * or 0 24 * * * | out of range: minute is 0-59, hour is 0-23 |
0 9 * * 1-5 assumed to be local time | on GitHub Actions it is 09:00 UTC unless the schedule sets a timezone |
The first row is the most common production bug: an unrestricted minute field means "every minute" for the whole hour you picked.
What a cron expression is, in one paragraph
A cron expression is a short text pattern that tells a scheduler when to run a job. In the classic form it is five fields (minute, hour, day of month, month, day of week) and the job runs at every minute that matches all of them. The same idea is reused by Linux crontab, GitHub Actions, Kubernetes CronJobs and many libraries, with small differences covered in the dialect sections of this guide. If you only need to turn an expression into words, the cron expression parser does that directly.
Common schedules: expression, plain English and next runs
Each expression below was run through Python croniter 6.2.4 (next runs, starting from Monday 2026-11-02 10:07 UTC) and through the npm package cronstrue 3.38.0 (the English description). Where the two agree, the row is one you can copy.
| Schedule you want | Expression | cronstrue says | Next runs |
|---|---|---|---|
| Every 5 minutes | */5 * * * * | Every 5 minutes | Mon 10:10, 10:15, 10:20, 10:25, 10:30 |
| Every 3 hours | 0 */3 * * * | On the hour, every 3 hours | Mon 12:00, 15:00, 18:00, 21:00, Tue 00:00 |
| Every day at midnight | 0 0 * * * | At 12:00 AM | Tue 11-03, Wed 11-04, Thu 11-05, Fri 11-06, Sat 11-07, all 00:00 |
| Every Monday at midnight | 0 0 * * mon | At 12:00 AM, only on Monday | Mon 11-09, 11-16, 11-23, 11-30, 12-07 |
| Weekdays at 9am | 0 9 * * mon-fri | At 09:00 AM, Monday through Friday | Tue 11-03 to Fri 11-06, then Mon 11-09 |
| Weekdays at 10pm | 0 22 * * 1-5 | At 10:00 PM, Monday through Friday | Mon 11-02 to Fri 11-06, all 22:00 |
| Weekends at noon | 0 12 * * sat,sun | At 12:00 PM, only on Saturday and Sunday | Sat 11-07, Sun 11-08, Sat 11-14, Sun 11-15, Sat 11-21 |
| 1st and 15th at 08:30 | 30 8 1,15 * * | At 08:30 AM, on day 1 and 15 of the month | Sun 11-15, Tue 12-01, Tue 12-15, Fri 2027-01-01, Fri 2027-01-15 |
| Twice an hour, at :05 and :35 | 5,35 * * * * | At 5 and 35 minutes past the hour | 10:35, 11:05, 11:35, 12:05, 12:35 |
| Every January 1st | 0 0 1 jan * | At 12:00 AM, on day 1 of the month, only in January | Fri 2027-01-01, Sat 2028-01-01, Mon 2029-01-01, Tue 2030-01-01, Wed 2031-01-01 |
Reading the table: lists use commas, ranges use a hyphen, steps use a slash, and three-letter names work in the month and weekday fields. The man-pages crontab(5) page confirms each of these: lists are "a set of numbers (or ranges) separated by commas", ranges are inclusive, steps are allowed after a range or an asterisk (*/2 for every two hours), and names are the first three letters, case insensitive.
The @ shortcuts
crontab(5) defines these nicknames. croniter returned the same run times as the long form for each:
| Shortcut | Equals | croniter next runs from the same start |
|---|---|---|
@hourly | 0 * * * * | 11:00, 12:00, 13:00, 14:00, 15:00 |
@daily | 0 0 * * * | Tue 11-03, Wed 11-04, Thu 11-05, Fri 11-06, Sat 11-07 |
@weekly | 0 0 * * 0 | Sun 11-08, 11-15, 11-22, 11-29, 12-06 |
@monthly | 0 0 1 * * | Tue 12-01, 2027-01-01, 02-01, 03-01, 04-01 |
@yearly and @annually | 0 0 1 1 * | 2027-01-01, 2028-01-01, 2029-01-01, 2030-01-01, 2031-01-01 |
@reboot | run once after reboot | no clock time, so there is nothing to list |
The shortcuts are a Vixie cron feature. GitHub Actions documents only the five fields with *, ,, - and /, so write the long form there.
Six fields: where the seconds go
Quartz-style schedulers put seconds first, so 0 */5 * * * * means "second 0 of every fifth minute". cronstrue reads six fields that way, and croniter does too when second_at_beginning=True is passed:
| Expression (seconds first) | cronstrue says | croniter next runs |
|---|---|---|
*/10 * * * * * | Every 10 seconds | 10:07:10, 10:07:20, 10:07:30, 10:07:40 |
0 */5 * * * * | Every 5 minutes | 10:10:00, 10:15:00, 10:20:00, 10:25:00 |
30 0 12 * * * | At 12:00:30 PM | Mon 12:00:30, Tue 12:00:30, Wed 12:00:30, Thu 12:00:30 |
Without that flag, croniter treats a sixth field as seconds at the end (0 0 * * * 30 ran at 00:00:30 each day). The same six numbers can therefore mean two different schedules depending on the library, which is why it pays to check which dialect your scheduler uses.
What each scheduler accepts, from its own documentation
These rows were read from the official pages on 2026-11-06 and are stated as those pages state them.
| Scheduler | Fields and ranges | Specials and limits | Source |
|---|---|---|---|
Vixie cron (crontab(5)) | 5 fields; day of week 0 to 7 with 0 and 7 as Sunday; month and weekday names | @ nicknames; lists, ranges and steps; if both day fields are restricted, either match runs the job | man7.org crontab(5) |
GitHub Actions schedule | 5 fields; day of week 0 to 6 or SUN to SAT | operators *, ,, -, / only; runs in UTC by default with an optional IANA time zone; shortest interval 5 minutes; runs can be delayed under load; scheduled workflows in a public repository are disabled after 60 days without repository activity | GitHub Docs, events that trigger workflows |
| Quartz CronTrigger | 6 fields with seconds first, optional 7th year (1970 to 2099); day of week 1 to 7 or SUN to SAT | ? (no specific value), L, W, #; one of the two day fields must currently be ? | Quartz 2.3.0 CronTrigger tutorial |
| Amazon EventBridge cron | 6 required fields: minutes, hours, day of month, month, day of week, year (1970 to 2199); no seconds; day of week 1 to 7 or SUN to SAT | ?, L, W, #; you cannot give a value or * in both day fields, so one must be ?; schedules faster than 1 minute are not supported | AWS EventBridge user guide, schedule patterns |
A practical consequence: the same intent is written differently in each place.
| Intent | Vixie cron and GitHub Actions | Quartz | EventBridge |
|---|---|---|---|
| Every day at noon | 0 12 * * * | 0 0 12 * * ? | cron(0 12 * * ? *) |
| Weekdays at 10:15 | 15 10 * * 1-5 | 0 15 10 ? * MON-FRI | cron(15 10 ? * MON-FRI *) |
| Last Friday of the month, 10:15 | not expressible in one line | 0 15 10 ? * 6L | cron(15 10 ? * 6L *) |
The Quartz noon, weekday and last-Friday lines come from the examples printed on the Quartz page, and cron(0 12 * * ? *) and the 6L form come from the AWS page. The EventBridge weekday line is the same weekday pattern written in that field order, built from the documented rules. Neither scheduler was executed here. cronstrue reads the Quartz noon line as "At 12:00 PM" and 0 0 L * * as "At 12:00 AM, on the last day of the month", but that is a description library, not proof that a given scheduler accepts the syntax.
Check the syntax before you deploy
The Debian crontab command has a dry-run flag. crontab -n file checks a file without installing it. Results on Ubuntu 24.04 (Vixie cron):
| File contents | Output | Exit code |
|---|---|---|
*/5 * * * * /bin/true | The syntax of the crontab file was successfully checked. | 0 |
60 * * * * /bin/true | "bad1.cron":0: bad minute | 1 |
0 9 * * funday /bin/true | "bad2.cron":0: bad day-of-week | 1 |
0 0 L * * /bin/true | "bad3.cron":0: bad day-of-month | 1 |
So real cron rejects L outright, even though a library such as croniter accepts it. To change your own schedule, run crontab -e; crontab -l lists what is installed.
Quick answers
- How do I write a cron expression? Pick the fields from left to right: minute, hour, day of month, month, day of week. Put
*in any field you do not want to restrict, then read the result back with a tool such as the Cron Builder. - How do I run a cron every 3 hours?
0 */3 * * *. It fires at hours 0, 3, 6, 9, 12, 15, 18 and 21, aligned to midnight and not to when you saved the file. - Is cron outdated? The five-field format is still what GitHub Actions and Kubernetes accept, as their documentation shows. Managed services add their own variants, and AWS recommends EventBridge Scheduler over its legacy scheduled rules.
- Why did my job not run when I expected? Check the time zone first. For a repository schedule see GitHub Actions schedule; for a hosting platform see cron jobs on Next.js and Vercel.
Sources used in this section: the crontab(5) man page, GitHub Docs on workflow events, the Quartz CronTrigger tutorial and the Amazon EventBridge schedule pattern guide.
Tested
Verified on 2026-11-02:
- Python 3.11 with
croniter6.2.4 for every next-run table and extension example. crontab(5)andcron(8)man pages from Ubuntu 24.04 (cron 3.0pl1-184ubuntu2) under WSL for field ranges, the 0/7 Sunday rule, the either-field-matches rule and the*/2 ... sunnote.- GNU
dateon Ubuntu 24.04 for the first-week and month-end tests. - GitHub Actions docs ("events that trigger workflows") for the UTC default, the optional IANA time zone, supported operators and the 5-minute minimum.
- 2026-11-06: Python 3.11 with
croniter6.2.4 and npmcronstrue3.38.0 for the common-schedule, shortcut and seconds tables;crontab -non Ubuntu 24.04 under WSL for the syntax-check table. - 2026-11-06: crontab(5) on man7.org, GitHub Docs (events that trigger workflows), the Quartz 2.3.0 CronTrigger tutorial and the Amazon EventBridge schedule pattern page were read for the dialect table.
- Not run: Quartz, Spring, AWS EventBridge, or a live cron daemon matching a real clock. The
cronstruetext for Quartz-style rows describes syntax only.
FAQ
What is the cron expression for every 5 minutes?
*/5 * * * *. From 10:07 it fires at 10:10, 10:15, 10:20, 10:25, 10:30. It is anchored to the clock, not to when you saved the file.
How do I run a cron job every weekday at 9am?
0 9 * * 1-5, or 0 9 * * mon-fri. The next five runs from Monday 2026-11-02 10:07 UTC are Tuesday 3rd through Friday 6th and then Monday 9th, all at 09:00 in the scheduler's time zone.
How do I run cron on the last day of the month?
Standard five-field cron cannot say it. Run on days 28 to 31 and test whether tomorrow is the 1st, as shown above, or use a scheduler with L (Quartz, Spring).
How do I run a cron job on the first Monday of the month?
Do not write 0 9 1-7 * 1: that is an OR and fires on days 1 to 7 and every Monday. Use 0 9 * * 1 with a date +%d test of 7 or less inside the job.
What does ? mean in a cron expression?
It means "no specific value" in Quartz and EventBridge, where exactly one of the two day fields must use it. Standard cron and GitHub Actions do not use it; write * instead.
Keep reading
Related tools
Cron Builder
Build and parse cron expressions with human-readable explanations.
Hours Calculator
Add start, end and break times for each day to see daily hours, weekly totals and overtime instantly.
Character Counter
Count characters, words, sentences, lines and UTF-8 bytes with live SEO and social media limit tracking.
Keyboard Test
Press any key to see it light up and find dead, stuck or double-typing keys, with rollover checks for full size, TKL and 75% layouts.
Written by Mian Ali Khalid. More guides in Dev Productivity.