Cron Expressions Explained with Practical Examples

How the five fields of a cron expression work, what the special characters mean, and ready to use schedules for common jobs.

By Utkarsh Garg · 2026-10-27 · 5 min read

The five fields

A standard cron expression has five fields separated by spaces. From left to right they are minute, hour, day of month, month and day of week. The job runs whenever the current time matches all the fields.

  • Minute: 0 to 59
  • Hour: 0 to 23
  • Day of month: 1 to 31
  • Month: 1 to 12
  • Day of week: 0 to 6, where 0 is Sunday. Many systems also accept 7 for Sunday.

Special characters

Four characters cover almost every schedule.

  • Asterisk (*) means every value in that field.
  • Comma (,) lists values, so 1,15 means the 1st and the 15th.
  • Hyphen (-) gives a range, so 1-5 in the day of week field means Monday to Friday.
  • Slash (/) gives a step, so */10 in the minute field means every 10 minutes.

Common schedules

These examples cover the jobs people schedule most often.

  • */15 * * * * runs every 15 minutes.
  • 0 * * * * runs at the start of every hour.
  • 30 2 * * * runs every day at 02:30.
  • 0 9 * * 1-5 runs at 09:00 on weekdays.
  • 0 0 1 * * runs at midnight on the first day of each month.
  • 0 0 * * 0 runs at midnight every Sunday.

Details that cause surprises

When both day of month and day of week are restricted, classic cron runs the job when either one matches, not both. So 0 0 13 * 5 runs on every 13th and also on every Friday, which is rarely what people intend.

Cron uses the time zone of the machine it runs on, which is often UTC on servers. A job set for 09:00 may fire at a different local time than you expect, and daylight saving changes can skip or repeat a run in some local time zones.

Not every scheduler uses the same syntax. Some add a seconds field in front, some add a year, and cloud schedulers often have their own rules for the day fields. Always check the documentation of the system that will run the job.

Test before you rely on it

A wrong cron expression usually fails silently: the job just runs at the wrong time or never. Translating the expression into plain English and checking the next run times is the fastest way to catch a mistake before it reaches production.

Worked example: reading an expression field by field

Take the expression 30 8 * * 1,3,5 and read it from left to right.

  • Minute: 30, so the job fires at minute 30.
  • Hour: 8, so the hour is 08.
  • Day of month: *, so any day of the month.
  • Month: *, so every month.
  • Day of week: 1,3,5, which is Monday, Wednesday and Friday.

Put together, the job runs at 08:30 every Monday, Wednesday and Friday, in the time zone of the machine. It does not run on the other four days. If you wanted it to run twice a day, say 08:30 and 17:30, you would list the hours: 30 8,17 * * 1,3,5.

More schedules and what they mean

Expressions people often get wrong
ExpressionWhat it runsNote
0 */6 * * *At 00:00, 06:00, 12:00 and 18:00Step counts from the start of the range
*/7 * * * *At minutes 0, 7, 14 and so on up to 56Then minute 0 again, so the last gap is 4 minutes, not 7
0 9-17 * * 1-5Every hour on the hour from 09:00 to 17:00 on weekdaysTen past is not included, only the top of the hour
0 0 31 * *Midnight on the 31stMonths with 30 days or fewer are skipped
0 0 29 2 *Midnight on February 29Only runs in leap years
* 3 * * *Every minute from 03:00 to 03:59Sixty runs, not one. Use 0 3 * * * for once

Common mistakes and how to spot them

  • The job runs every minute instead of once an hour. The minute field is a star. Write 0 * * * * for the top of the hour, not * * * * *.
  • The job runs at the wrong hour. Compare the server time zone with yours. Check with the date command on the machine, and convert before choosing the hour.
  • The job never runs. Look for a 31 in the day of month field combined with a month that has 30 days, or a typo such as 60 in the minute field, which is out of range.
  • The job works in a shell but not from cron. Cron uses a minimal environment, so use full paths to programs and files, and set any needed variables inside the script.
  • Output is missing. Cron may send output by local mail. Redirect it to a log file so errors are visible, for example by adding > /var/log/job.log 2>&1 after the command.
  • Two copies run at once because a slow job overlaps the next start. Add a lock or choose a longer interval.

Frequently asked questions

  • How do I run a cron job every 5 minutes? Use */5 * * * *. The step in the minute field runs it at minutes 0, 5, 10 and so on.
  • What does 0 0 * * * mean? It runs once a day at midnight in the machine's time zone.
  • How do I run a job on the last day of the month? Standard cron has no last day option. A common workaround is to run daily and let the script check whether tomorrow is the first. Some schedulers add an L character, so check the documentation.
  • Is Sunday 0 or 7? Most systems accept both, but 0 is the safest choice because some do not accept 7.
  • Can cron run a job every 30 seconds? Standard five field cron cannot go below one minute. Use a scheduler with a seconds field, or a loop with sleep inside the job.