Skip to the content

Cron Expression Explainer

Translate a cron schedule into plain English and see when it runs next.

At 09:30 on Monday to Friday

FieldValueMatches
Minute3030
Hour99
Day of month*every day of the month
Month*every month
Day of week1-5Monday to Friday

Next 10 runs

    Cron goes by the clock of the machine it runs on. These are the runs on a machine in your time zone.

    Share this tool:TwitterFacebookLinkedInWhatsAppEmail

    The five fields

    A cron expression is five fields separated by spaces. The job runs in every minute in which all five agree with the clock.

    FieldAllowed valuesRemarks
    Minute0-59
    Hour0-230 is midnight
    Day of month1-31
    Month1-12 or JAN-DEC
    Day of week0-7 or SUN-SAT0 and 7 are both Sunday

    30 9 * * 1-5 reads as minute 30, hour 9, any day of the month, any month, Monday to Friday: 09:30 on working days.

    Inside a field you can write:

    SyntaxMeaningExample
    *every value* as hour: every hour
    a,ba list0,30 as minute: on the hour and at half past
    a-ba range, both ends included9-17 as hour
    */nevery nth value, counted from the lowest*/15 as minute: 0, 15, 30 and 45
    a-b/nevery nth value within a range10-40/5 as minute: 10, 15, 20 up to 40

    Two classic traps

    A step starts again with every hour, day or month. */7 in the minute field is not "every seven minutes". It is minutes 0, 7, 14 and so on up to 56, and then minute 0 again, four minutes later. Only steps that divide the range evenly give a steady rhythm: for minutes those are 2, 3, 4, 5, 6, 10, 12, 15, 20 and 30. In the same way */2 as day of month runs on the 31st and again on the 1st.

    Day of month and day of week are joined by "or". 0 0 13 * 5 is not Friday the 13th. When both fields are restricted, the job runs when either one matches: on every 13th and on every Friday. The expression has no way to ask for both. The usual way round it is to schedule one of them and test the other in the command:

    0 0 13 * * [ "$(date +\%u)" = 5 ] && /path/to/job
    

    The backslash is needed because cron treats a bare % in a command as a line break.

    There is one exception. Vixie cron and its successor cronie, which most Linux distributions use, count a day field that starts with * as unrestricted. 0 0 */2 * 1 therefore runs on odd dates that are also Mondays. This page follows that rule.

    Time zones and daylight saving

    Cron compares the fields with the local clock of the machine it runs on. On a server set to UTC, 0 9 * * * fires at 09:00 UTC, which is 10:00 in Amsterdam in winter and 11:00 in summer. The list of next runs can be worked out for your own time zone or for UTC.

    Where the clocks change for daylight saving, an hour of one night in spring does not exist, and a job scheduled in it is skipped. In autumn an hour comes round twice and the job runs twice. That is what a cron that simply checks the clock does, and it is what the list on this page shows. cronie softens this for jobs with a fixed time: those from the skipped hour run straight after the change, and those in the repeated hour run once. Jobs that run every hour or more often are not adjusted. If the exact moment matters, keep such jobs out of the small hours or run the server on UTC.

    What this page reads

    • Five fields, or six with a seconds field in front, as Quartz and Spring write them. A system crontab has no seconds.
    • The shortcuts @hourly, @daily or @midnight, @weekly, @monthly, @yearly or @annually, and @reboot.
    • A whole line from a crontab. What follows the schedule is shown as the command.
    • ?, which Quartz wants in one of the two day fields, is read as *.

    The other Quartz extensions are not supported: L (last), W (nearest working day), # (the nth weekday of the month) and a seventh field for the year. Check the weekday numbers when you paste a Quartz expression: Quartz counts from 1 for Sunday to 7 for Saturday, while crontab and this page use 0 or 7 for Sunday and 1 for Monday. Names such as MON mean the same in both.

    Two things that other schedulers accept are errors here, as they are in a crontab: a range that wraps around (22-2, write 22-23,0-2) and a step without a range in front (5/15). The ~ of cronie, which picks a random value, is refused because it has no fixed time to show.

    See all 12