The cron asterisk: what * means in each field
An asterisk means every value the field allows, from its minimum to its maximum. What that expands to depends entirely on which field it is in.
At a glance
- Meaning
- Match every value in this field, with no restriction.
- In the minute field
- All 60 values, 0 through 59.
- In the hour field
- All 24 values, 0 through 23.
- In the day of month field
- All 31 values, 1 through 31.
- In the day of week field
- 0 through 7, where both 0 and 7 mean Sunday.
- Combined with a step
- */n walks the whole range from its minimum in increments of n.
In detail
The asterisk is not a value, it is the absence of a restriction. When the parser sees one it fills the field with every number the field allows, which is why the same character expands to sixty values in the minute field, twenty four in the hour field and twelve in the month field. Nothing about the asterisk itself says how many.
That distinction explains the most common cron misreading. * */1 * * * looks like it says once an hour, because the */1 draws the eye. But a step of one matches every value, exactly as an asterisk would, and the minute field is still unrestricted, so the expression is identical to * * * * * and runs 1,440 times a day.
Fields left open are what make a schedule repeat. A time is pinned by the fields that carry values and repeated by the fields that carry asterisks: 0 3 * * * pins a time and repeats over dates, while 0 3 1 * * pins a time and a date and repeats over months. Reading an expression from the right is often easier for this reason.
One field is special. Leaving the day of week field as an asterisk is what keeps the day of month restriction working as an AND. Once both date fields carry a restriction, cron switches to matching either one, which is a rule with its own page because of how often it catches people.
Examples
* * * * *Every minute of every hour of every day.
30 4 * * *04:30 every day. The three asterisks are what make it daily.
* */1 * * *Every minute, not every hour. */1 matches all 24 hours and the minute field is still open.
Things that catch people out
- */1 is the same as *. It never means once per unit.
- An asterisk in the day of month field means all 31 values, including the 29th, 30th and 31st, which do not exist in every month. Those dates simply never match.
- Replacing an asterisk with a restriction in the day of week field changes how the day of month field behaves, because of the OR rule between the two.
Try it: Cron Expression Parser
Paste any five or six field expression to get a plain English description, a per field breakdown and the next run times in your local time.
Cron Expression Parser
LOCAL · Browser-OnlyParse cron expressions and see the next scheduled run times
Supports 5-field (minute hour day month weekday), 6-field (with seconds), named values (JAN, MON), and @macros (@daily, @hourly, ...)
Use the dropdowns below to build your cron expression visually, or type a custom value in each field.
Human-Readable Description
Every 5 minutes
Field Breakdown
| Field | Allowed | Value | Meaning |
|---|---|---|---|
| Minute | 0-59 | */5 | every 5 minute(s) |
| Hour | 0-23 | * | every hour |
| Day of Month | 1-31 | * | every day of month |
| Month | 1-12 | * | every month |
| Day of Week | 0-7 | * | every day of week |
Related cron expressions
All cron expressions →Cron step values: what */n really does
*/n walks a field from its minimum in increments of n. Because it starts at the field minimum, */2 gives even minutes and odd days of the month.
Cron day of month and day of week: the OR rule
When both date fields are restricted, cron fires if either matches, not both. This turns narrowing expressions into much wider ones without any error.
The cron minute field: position, range and behaviour
The minute field runs 0 to 59 and is the first field in a five field expression, or the second when a seconds field is present.
The cron comma: listing several values in one field
A comma joins several values into one field, and each element can itself be a value, a range or a step. Spaces inside a list break the expression.
The cron hyphen: inclusive ranges and why they cannot wrap
A hyphen range includes both ends, so 9-17 is nine values. The start must not be greater than the end, which is why 22-6 is rejected.
Cron n/step: starting a step from a value you choose
The form 5/15 means start at 5 and step by 15, giving 5, 20, 35 and 50. It is how you move a repeating job off the crowded top of the hour.
Tools for this
- Cron Expression Parser Free online cron expression parser - parse cron expressions and see the next scheduled run times
- Crontab Generator Free online crontab generator - build cron expressions visually with an intuitive interface