Skip to content

Cron expression explainer

Free, no sign-up Runs in your browser

Paste a five-field cron expression and read it in plain words, with the next five run times in UTC and in your time zone. Invalid input is explained.

Five fields: minute, hour, day of month, month, day of week. Or a shortcut such as @daily.

Everything you type here stays in your browser. Nothing is sent to HardenKit or to anyone else.

How to use the cron expression explainer

  1. Paste the five fields of the schedule, without the command.
  2. Read the description and the table that explains each field.
  3. Choose whether cron runs on a UTC clock or on your time zone.
  4. Check the next five run times.

About this tool

A cron expression has five fields: minute, hour, day of month, month and day of week. Each can be a value, a range (9-17), a list (1,15), a step (*/15) or a star for every value. Months and weekdays also take names such as JAN and MON. Shortcuts like @daily and @hourly stand for common schedules.

One rule surprises almost everyone. When both the day of month and the day of week are restricted, cron runs the job when either matches, not when both do. So 0 0 13 * FRI is midnight on every 13th and on every Friday, not only on Friday the 13th. This tool follows that rule, and says so in the description.

The other trap is time zones. Cron reads the clock of the machine it runs on, and many servers are set to UTC, so a job written for 9 in the morning may run at a different local hour. Choose which clock the job runs on and the next run times are shown in UTC and in your own zone. HardenKit Scan’s README uses a cron line to run hardenkit watch once a day.

Sources

Questions

What does */15 * * * * mean in cron?

Every 15 minutes: at minutes 0, 15, 30 and 45 of every hour, every day. The step is counted from the start of the range, so it restarts at each hour.

What are the five fields of a cron expression?

Minute (0 to 59), hour (0 to 23), day of month (1 to 31), month (1 to 12 or JAN to DEC) and day of week (0 to 7 or SUN to SAT, where both 0 and 7 are Sunday). In a crontab the command follows the fifth field.

How do I run a cron job on the first Monday of the month?

Not with the day fields alone: 0 9 1-7 * MON runs on days 1 to 7 and also on every Monday, because cron matches either field. The usual answer is to schedule every Monday and test the date in the command, for example with [ "$(date +%d)" -le 07 ].

Why does my cron job run at the wrong time?

Most often the server’s clock is in another time zone than you had in mind, usually UTC. Check it with the date command. Daylight saving changes can also skip or repeat jobs scheduled in the hour that moves.

Does cron support seconds?

No. Standard cron has five fields and its smallest unit is the minute. Six and seven field expressions with seconds or years belong to other schedulers, such as Quartz.

Related tools