ShareYourGroupShareYourGroupCron Helper

Cron syntax: the five fields and every symbol

A cron expression is five values separated by spaces. Once you can read the five places, you can read any schedule.

The five fields

Standard cron, the kind used in a Linux or Mac crontab, in GitHub Actions and in Kubernetes, reads five fields from left to right.

PositionFieldAllowed values
1Minute0 to 59
2Hour0 to 23 (24-hour clock)
3Day of the month1 to 31
4Month1 to 12, or JAN to DEC
5Day of the week0 to 6 with 0 = Sunday, or SUN to SAT. Most Linux cron also accepts 7 as Sunday

The first row of a table is its heading, so the order to remember is "minute, hour, day, month, weekday": small units first, then bigger ones, then the odd one out. Cron looks at the clock once a minute. When the minute, the hour and the month all match, and the day rule matches, the command runs.

The four symbols

Names are allowed in the month and weekday fields: the first three letters, in any case. mon,wed,fri and jan-mar are both fine, and the cron manual notes that ranges and lists of names are allowed.

Reading an expression in four steps

Take 30 8 * * 1-5. Read it field by field. Minute: 30. Hour: 8. Day of the month: every day. Month: every month. Day of the week: 1 to 5, which is Monday to Friday. Together: "at 08:30 on weekdays". Now take 0 */4 1,15 * *: minute 0, every fourth hour (0, 4, 8, 12, 16, 20), on days 1 and 15 of every month, which is six runs on each of those two days.

Where it differs between systems

Not every system reads the same five fields in exactly the same way:

The tool on the home page has a type selector for these four, so you can paste an expression and see whether it is accepted where you plan to use it.

Frequently asked

Is the first field minutes or seconds?

Minutes in standard five-field cron. Only Quartz and Spring expressions (six or seven fields) start with seconds.

Can I use 24 for midnight in the hour field?

No. The hour field runs from 0 to 23, and midnight is 0.

Does cron care about spaces?

Fields are separated by one or more spaces or tabs. The tool above collapses extra spaces before reading.

This is an independent guide and tool. It is not connected with crontab.guru, Quartz, GitHub, Kubernetes, Spring or the Linux projects named here. Product names belong to their owners.