Cron Expression Cheat Sheet With Real Examples
Cron syntax on one page: the five fields, the four operators, copy-ready schedules, and the gotchas around day-of-week OR logic, DST and nonstandard variants.
Updated
A cron expression is five space-separated fields: minute, hour, day of month, month, day of week. 0 9 * * 1-5 means 09:00 every weekday. * means every value, , lists values, - gives a range, and / sets a step. That is most of the syntax; the rest of this page is examples and the gotchas.
The five fields
In order, with their allowed ranges:
- Minute:
0-59 - Hour:
0-23(24-hour clock) - Day of month:
1-31 - Month:
1-12orJAN-DEC - Day of week:
0-6where0is Sunday (7also means Sunday on most systems), orSUN-SAT
The expression fires when the current time matches all fields, with one exception covered below. Times are evaluated in the timezone of the machine or service running the scheduler, which is usually UTC on servers and in containers.
Operators
*any value.* * * * *is every minute.,list.0 9,17 * * *is 09:00 and 17:00.-range.0 9-17 * * *is the top of every hour from 09:00 through 17:00, nine runs./step.*/15 * * * *is every 15 minutes::00,:15,:30,:45.0 */6 * * *is every six hours. Steps can start from an offset:5/15in the minute field means:05,:20,:35,:50.
Operators combine: 0 8-18/2 * * 1-5 is every two hours from 08:00 to 18:00 on weekdays.
Real examples
* * * * *every minute*/5 * * * *every 5 minutes0 * * * *every hour, on the hour30 * * * *every hour at :300 0 * * *daily at midnight0 3 * * *daily at 03:00, the classic backup slot0 9 * * 1-5weekdays at 09:000 0 * * 0weekly, Sunday midnight0 0 * * 1weekly, Monday midnight0 0 1 * *first day of every month at midnight0 0 1 1 *once a year, January 10 0 1 */3 *quarterly: Jan 1, Apr 1, Jul 1, Oct 10 9,13,17 * * *three times a day0 22 * * 1-5weeknights at 22:000 0 * * 6,0Saturday and Sunday at midnight15 2 * * *02:15 daily, offset from the top of the hour0 0 */2 * *every other day, roughly; the step resets on the 1st, so a 31-day month ends with back-to-back runs
Building one of these by hand is easy. Checking that it does what you meant is where the Cron Expression Builder helps: it turns any expression into a plain English sentence and lists the next five run times.
The gotchas
Day of month and day of week are OR, not AND
This is the most surprising rule in cron. If both day fields are restricted, the job runs when either matches. 0 0 13 * 5 runs on the 13th of every month and on every Friday, not only on Friday the 13th. There is no standard cron syntax for "the 13th only if it is a Friday"; do that check inside the script.
Last day of the month
Standard cron has no L. 0 0 28-31 * * fires up to four times. The common workaround is to run daily and let the script check whether date -d tomorrow +%d equals 01. Quartz (Java) and some cloud schedulers extend the syntax with L, W and #, but those expressions will not run on a Linux crontab.
Daylight saving time
A job at 0 2 * * * in a timezone with DST will be skipped on the spring-forward night and run twice on the fall-back night. Schedule servers in UTC, or choose hours that never fall in the transition window.
Nonstandard variants
- Linux crontab accepts
@hourly,@daily,@weekly,@monthly,@yearlyand@reboot. - Quartz, Spring and some AWS services use six or seven fields, adding seconds at the front and an optional year at the end.
0 0 9 * * ?is Quartz for daily at 09:00; the?means "no specific value" and is required in one of the two day fields. - GitHub Actions and Kubernetes CronJobs use the standard five fields in UTC. GitHub also documents that the shortest allowed interval is five minutes and that jobs may start late at busy times.
Cron has no memory. If the machine is off or the container is not running at the scheduled minute, that run is simply missed. Use a job queue or a scheduler with catch-up semantics if every run matters.
Checking your schedule
The next-run list is the fastest sanity check. If the first five times are not what you pictured, the expression is wrong. For a job that writes timestamps into logs or a database, convert the recorded epoch values with the Unix timestamp converter and compare them against the intended schedule; a one-hour drift after a DST change is a common find.
To measure how far apart two runs really were, the Duration Calculator gives the exact gap in days, hours and minutes between two timestamps.
Other schedule and formatting helpers are in the developer category.
Try it
Type or build an expression in the Cron Expression Builder, read the English summary, and confirm the next five run times before it goes into a crontab, a CI workflow or a CronJob manifest.