Cron expression explainer

See what a cron schedule means in plain English, and when it will run next.

Next runs (your time zone)

    This tool runs in your browser. We never send what you type or paste to a server.

    Cron syntax

    A standard cron expression has five fields:

    FieldValues
    Minute0–59
    Hour0–23
    Day of month1–31
    Month1–12 or JAN–DEC
    Day of week0–6 or SUN–SAT (7 is also Sunday)

    * means every value, 1-5 a range, 1,15 a list, and */15 every 15th value.

    Examples

    • */5 * * * *: every 5 minutes
    • 0 9 * * 1-5: at 09:00 on weekdays
    • 30 2 1 * *: at 02:30 on the 1st of every month
    • 0 0 * * 0: at midnight every Sunday

    A cron gotcha

    When both day of month and day of week are restricted, classic cron runs the job when either matches. 0 0 13 * 5 runs on the 13th of every month and every Friday, not only on Friday the 13th.

    More examples, read aloud

    */15 9-17 * * 1-5   every 15 minutes, 09:00 to 17:45, Monday to Friday
    30 9,17 * * *       at 09:30 and 17:30 every day
    0 10 * * SAT-SUN    at 10:00 on Saturday and Sunday
    0 0 1 * *           at midnight on the first of every month

    Special strings

    Most cron daemons accept a shortcut in place of the five fields. The explainer expands all of them except @reboot, which is an event rather than a schedule.

    • @hourly = 0 * * * * (every hour)
    • @daily and @midnight = 0 0 * * * (every day at midnight)
    • @weekly = 0 0 * * 0, midnight on Sunday
    • @monthly = 0 0 1 * * (first day of the month)
    • @yearly and @annually = 0 0 1 1 *, midnight on 1 January
    • @reboot: once, when the cron daemon starts after a boot

    Every shortcut runs at minute 0 of the hour, so if many servers use @daily they all fire at the same second. When a job calls a shared API, pick an odd minute instead, such as 17 3 * * *.

    Editing a crontab

    On Linux and macOS each user has their own crontab, which you edit with the crontab command rather than by opening the file directly. It checks the syntax when you save and tells the daemon to reload.

    crontab -e                # open your crontab in $EDITOR
    crontab -l                # print it
    crontab -l > cron.bak     # back it up
    crontab cron.bak          # replace it with the contents of a file
    sudo crontab -u www-data -l   # another user's crontab

    (Shell commands for Linux and macOS, not run on this page.) Be careful with crontab -r: it deletes the whole crontab at once, without asking, and r sits next to e on the keyboard. Keeping a copy with crontab -l > cron.bak before big edits costs nothing.

    Where the files live:

    • User crontabs: under /var/spool/cron/ (in crontabs/ on Debian and Ubuntu). Use crontab -e, not an editor, to change them.
    • /etc/crontab and /etc/cron.d/*: system crontabs. These have an extra field, the user to run as, between the schedule and the command: 30 2 * * * root /usr/local/bin/backup. A line copied from a user crontab into /etc/cron.d without that field will not run as you expect.
    • /etc/cron.daily, cron.weekly, cron.monthly: directories of executable scripts run at a time set in /etc/crontab or by anacron. They take no schedule at all.

    Environment, output and logs

    The usual reason a job works in your terminal and fails under cron is the environment. Cron does not read your .bashrc or .profile: commands run with /bin/sh and a short PATH (often just /usr/bin:/bin), so tools in /usr/local/bin, nvm or a virtualenv are not found. Use absolute paths, or set variables at the top of the crontab:

    SHELL=/bin/bash
    PATH=/usr/local/bin:/usr/bin:/bin
    MAILTO=ops@example.com
    
    15 3 * * * /home/deploy/bin/backup.sh >> /var/log/backup.log 2>&1
    0 0 * * * tar czf /backups/site-$(date +\%F).tgz /var/www

    Three more things that catch people out:

    • A bare % in the command becomes a newline, and everything after it is sent to the command as standard input. Escape it as \%, as in the date call above, or move the command into a script.
    • Anything the job prints is mailed to the crontab's owner, or to MAILTO. With no mail system installed it is simply lost, so redirect output to a log file with >> file 2>&1. MAILTO="" turns mail off.
    • The last line of a crontab must end with a newline, or cron may ignore it.

    To check that a job ran, look at the daemon's log: grep CRON /var/log/syslog or journalctl -u cron on Debian and Ubuntu, and /var/log/cron or journalctl -u crond on Red Hat, Fedora and similar.

    Time zones and daylight saving

    Cron reads the schedule in the time zone of the machine it runs on. Many servers use UTC, which never changes, so a job at 09:00 UTC moves by an hour in local time when the clocks change:

    // A job set to "0 9 * * *" on a server that runs on UTC, seen from New York and London.
    const at = (iso, timeZone) => new Date(iso).toLocaleTimeString('en-GB', { timeZone, hour: '2-digit', minute: '2-digit', timeZoneName: 'short' });
    console.log(at('2026-01-15T09:00Z', 'America/New_York'));   // → 04:00 GMT-5
    console.log(at('2026-07-15T09:00Z', 'America/New_York'));   // → 05:00 GMT-4   an hour later in summer
    console.log(at('2026-07-15T09:00Z', 'Europe/London'));      // → 10:00 BST

    If a job must run at a fixed local time, either set the server's time zone or, with cronie (the cron on Red Hat and Fedora), put CRON_TZ=Europe/London at the top of the crontab. On a machine that does follow daylight saving, times between about 01:00 and 03:00 can be skipped or repeated on the night the clocks change, and implementations handle that differently. Scheduling outside that window avoids the question.

    Questions

    Does it support seconds?

    This explainer uses the standard 5-field format. Some schedulers (like Quartz) add a seconds field at the start.

    Which time zone does cron use?

    The time zone of the machine or service running it, which on servers is often UTC. The next runs on this page are shown in your own time zone, so check the difference before you rely on them.

    Why does my cron job work in the terminal but not from cron?

    Cron runs commands with /bin/sh, a minimal PATH and none of your shell startup files. Use absolute paths to programs and files, set PATH at the top of the crontab, escape any % as \%, and redirect output to a log file so you can see the error.

    How do I check whether a cron job ran?

    Look in the cron daemon log: grep CRON /var/log/syslog or journalctl -u cron on Debian and Ubuntu, /var/log/cron or journalctl -u crond on Red Hat and Fedora. Adding >> /path/to/log 2>&1 to the job also records its own output and errors.

    What does @reboot do?

    It runs the command once each time the cron daemon starts, which normally means after the machine boots. It is handy for starting a small service, but it has no retry or ordering, so for anything important a systemd service is more dependable.