Xerobit
Dev Productivity

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.

MA Mian Ali Khalid Updated Nov 6, 2026 8 min read
Free tool
Cron Builder
Build and parse cron expressions with human-readable explanations.
Open tool →
On this page ⌄
  1. The five fields
  2. Next run times, computed
  3. The day-of-month and day-of-week trap
  4. Sunday is 0 or 7 (and Quartz is different)
  5. Which dialect are you writing?
  6. Common mistakes
  7. What a cron expression is, in one paragraph
  8. Common schedules: expression, plain English and next runs
  9. What each scheduler accepts, from its own documentation
  10. Check the syntax before you deploy
  11. Quick answers
  12. Tested
  13. 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:

SyntaxMeaningExampleReads as
*every value* * * * *every minute
5one value5 * * * *minute 5 of every hour
1,15list0 0 1,15 * *midnight on the 1st and 15th
1-5inclusive range0 9 * * 1-509:00, Monday to Friday
*/15step over the full range*/15 * * * *minutes 0, 15, 30, 45
9-17/4step inside a range30 9-17/4 * * 1-509:30, 13:30, 17:30 on weekdays
mon-frinames (3 letters)0 12 * * mon-frinoon 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.

ExpressionNext 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-513:30, 17:30 today, then 09:30, 13:30, 17:30 on Tuesday
0 9 * * 1-5Tue 11-03, Wed 11-04, Thu 11-05, Fri 11-06, Mon 11-09, all 09:00
0 0 * * 0Sundays: 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?

SchedulerFieldsTime zoneNotes
Linux/Unix cron5server local timeno L, # or ? in the man page
GitHub Actions5UTC by default, optional IANA timezone per scheduleoperators *, ,, -, / only (GitHub docs); minimum interval 5 minutes. See GitHub Actions schedules
Kubernetes CronJob5controller-manager zone, or spec.timeZoneCRON_TZ= inside the schedule is rejected.
Quartz / Spring6 or 7 (leading seconds, optional year)configurable?, L, W, # available
AWS EventBridge rules6 (adds year, no seconds)UTCone 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 wroteWhat 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 * 1OR 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 timeon 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 wantExpressioncronstrue saysNext runs
Every 5 minutes*/5 * * * *Every 5 minutesMon 10:10, 10:15, 10:20, 10:25, 10:30
Every 3 hours0 */3 * * *On the hour, every 3 hoursMon 12:00, 15:00, 18:00, 21:00, Tue 00:00
Every day at midnight0 0 * * *At 12:00 AMTue 11-03, Wed 11-04, Thu 11-05, Fri 11-06, Sat 11-07, all 00:00
Every Monday at midnight0 0 * * monAt 12:00 AM, only on MondayMon 11-09, 11-16, 11-23, 11-30, 12-07
Weekdays at 9am0 9 * * mon-friAt 09:00 AM, Monday through FridayTue 11-03 to Fri 11-06, then Mon 11-09
Weekdays at 10pm0 22 * * 1-5At 10:00 PM, Monday through FridayMon 11-02 to Fri 11-06, all 22:00
Weekends at noon0 12 * * sat,sunAt 12:00 PM, only on Saturday and SundaySat 11-07, Sun 11-08, Sat 11-14, Sun 11-15, Sat 11-21
1st and 15th at 08:3030 8 1,15 * *At 08:30 AM, on day 1 and 15 of the monthSun 11-15, Tue 12-01, Tue 12-15, Fri 2027-01-01, Fri 2027-01-15
Twice an hour, at :05 and :355,35 * * * *At 5 and 35 minutes past the hour10:35, 11:05, 11:35, 12:05, 12:35
Every January 1st0 0 1 jan *At 12:00 AM, on day 1 of the month, only in JanuaryFri 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:

ShortcutEqualscroniter next runs from the same start
@hourly0 * * * *11:00, 12:00, 13:00, 14:00, 15:00
@daily0 0 * * *Tue 11-03, Wed 11-04, Thu 11-05, Fri 11-06, Sat 11-07
@weekly0 0 * * 0Sun 11-08, 11-15, 11-22, 11-29, 12-06
@monthly0 0 1 * *Tue 12-01, 2027-01-01, 02-01, 03-01, 04-01
@yearly and @annually0 0 1 1 *2027-01-01, 2028-01-01, 2029-01-01, 2030-01-01, 2031-01-01
@rebootrun once after rebootno 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 sayscroniter next runs
*/10 * * * * *Every 10 seconds10:07:10, 10:07:20, 10:07:30, 10:07:40
0 */5 * * * *Every 5 minutes10:10:00, 10:15:00, 10:20:00, 10:25:00
30 0 12 * * *At 12:00:30 PMMon 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.

SchedulerFields and rangesSpecials and limitsSource
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 jobman7.org crontab(5)
GitHub Actions schedule5 fields; day of week 0 to 6 or SUN to SAToperators *, ,, -, / 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 activityGitHub Docs, events that trigger workflows
Quartz CronTrigger6 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 cron6 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 supportedAWS EventBridge user guide, schedule patterns

A practical consequence: the same intent is written differently in each place.

IntentVixie cron and GitHub ActionsQuartzEventBridge
Every day at noon0 12 * * *0 0 12 * * ?cron(0 12 * * ? *)
Weekdays at 10:1515 10 * * 1-50 15 10 ? * MON-FRIcron(15 10 ? * MON-FRI *)
Last Friday of the month, 10:15not expressible in one line0 15 10 ? * 6Lcron(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 contentsOutputExit code
*/5 * * * * /bin/trueThe syntax of the crontab file was successfully checked.0
60 * * * * /bin/true"bad1.cron":0: bad minute1
0 9 * * funday /bin/true"bad2.cron":0: bad day-of-week1
0 0 L * * /bin/true"bad3.cron":0: bad day-of-month1

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 croniter 6.2.4 for every next-run table and extension example.
  • crontab(5) and cron(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 ... sun note.
  • GNU date on 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 croniter 6.2.4 and npm cronstrue 3.38.0 for the common-schedule, shortcut and seconds tables; crontab -n on 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 cronstrue text 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

Written by Mian Ali Khalid. More guides in Dev Productivity.