How to Read and Write Cron Expressions (With Real Examples)

Learn what each of the five cron fields means, how lists, ranges and steps work, and how to avoid the time zone and day-matching traps that break jobs.

Updated September 29, 2026 7 min read

Use the free Cron Expression GeneratorBuild and explain cron schedules with next run times

A nightly database backup, a report that should land in inboxes every Monday morning, a cache that needs clearing every fifteen minutes: sooner or later most people who run a server, a CI pipeline or a hosting control panel are asked to type a line like 0 9 * * 1-5 and trust that it means what they think it means. Cron syntax is compact, which is why it has survived for decades, but that compactness also makes it easy to schedule a job for the wrong day, the wrong hour or not at all.

This guide walks through the five fields of a standard cron expression, the special characters you can use in them, and the handful of rules that trip people up. You will also see how to build and double-check a schedule in the browser, and when it makes more sense to use your platform's own scheduler instead.

The anatomy of a cron expression

A standard cron expression is five fields separated by spaces. Each field restricts one part of the date and time:

Position Field Allowed values
1 Minute 0-59
2 Hour 0-23
3 Day of month 1-31
4 Month 1-12 or JAN-DEC
5 Day of week 0-7 or SUN-SAT (0 and 7 are both Sunday)

A job runs whenever the current minute matches all of the fields, with one exception covered below. The expression 30 2 * * * therefore means "at minute 30 of hour 2, on every day of every month", which is 02:30 daily.

The special characters

  • * means "every value". * in the hour field means every hour.
  • , builds a list. 0,30 in the minute field means on the hour and at half past.
  • - builds a range. 1-5 in the day-of-week field means Monday to Friday.
  • / adds a step. */15 in the minute field means every 15 minutes starting at 0 (0, 15, 30, 45). 5/15 would start at 5 instead (5, 20, 35, 50).

Many cron implementations also accept shortcuts such as @daily, @hourly, @weekly, @monthly and @yearly. @daily is the same as 0 0 * * *, and @weekly runs at midnight on Sunday.

Reading a few common schedules

*/5 * * * *        every 5 minutes
0 * * * *          at the start of every hour
0 9 * * 1-5        09:00 Monday to Friday
0 0 1 * *          midnight on the 1st of each month
0 0 1 1,4,7,10 *   midnight on the first day of each quarter
0 */6 * * *        every 6 hours (00:00, 06:00, 12:00, 18:00)

A useful habit is to read an expression from right to left: which weekdays, which months, which days, which hour, which minute. Saying it aloud catches most mistakes.

The day-of-month and day-of-week trap

This is the rule that surprises almost everyone. In the widely used Vixie cron behaviour, when both the day-of-month and day-of-week fields are restricted (neither is *), the job runs when either one matches, not when both do.

So 0 9 13 * 5 does not mean "Friday the 13th at 9 AM". It means "9 AM on the 13th of every month, and also 9 AM every Friday". If you really need "Friday the 13th", schedule the job for every Friday and let the script check the date before doing any work.

Build and check a schedule in the browser

Writing cron by hand is fine once you are fluent, but a visual builder and an independent preview of upcoming run times are the quickest way to confirm your intent. The Cron Expression Generator works entirely in your browser.

  1. Open the Cron Expression Generator. It starts with 0 9 * * 1-5, a weekday 9 AM schedule, so you can see how the output looks.
  2. For a quick start, open Common presets and choose a schedule such as "Every 15 minutes", "Weekdays at 9 AM" or "Every quarter".
  3. To build your own, use the tabs under Build your schedule: Minute, Hour, Day of month, Month and Day of week. For each one choose Every…, Specific values (click the values you want), Range (pick From and To) or Step (every N) (set Every and Starting at).
  4. Watch the Cron expression box update, with each part labelled underneath. You can also type directly into that box.
  5. Read the In plain English description, then check Next 5 run times (your local time) to confirm the job fires when you expect.
  6. If you already have an expression from a crontab or a colleague, paste it into Parse an existing expression and click Parse. The builder tabs update to match, and month or day names and @daily-style macros are accepted.
  7. Use the copy button to take the expression to your crontab, CI file or control panel. Reset returns to "every minute".

If the preview says the schedule never fires in the next few years, you have asked for an impossible date such as 30 February.

Other ways to create and test cron schedules

Directly in crontab

On Linux and macOS, crontab -e opens your personal crontab in an editor, and crontab -l lists it. Each line is an expression followed by the command to run:

0 2 * * * /usr/local/bin/backup.sh >> /var/log/backup.log 2>&1

Always redirect output to a log file. Cron runs with a minimal environment, and a silently failing job is the most common cron problem of all.

Hosting control panels and CI services

Many hosting panels offer a cron form with drop-down menus, and CI platforms accept cron strings in their pipeline files. These are often the better choice because they log each run for you. Check their documentation for two things: which time zone they use, and whether they accept the five-field format or expect a different one.

Other cron dialects

Not every system uses the same format. Quartz (common in Java applications) adds a seconds field at the start and sometimes a year at the end, and uses ? for "no specific value". Some cloud schedulers have their own variations. If your platform expects six or seven fields, a five-field expression will be rejected or, worse, shifted by one position. Confirm the format before copying.

Tips and troubleshooting

Time zones

Cron uses the time zone of the machine or service running it, and many servers run in UTC. A schedule you preview in your local time may therefore fire hours earlier or later on the server. If a report is meant for 9 AM in a particular office, convert that time to the server's zone first, and remember that daylight saving changes can shift or skip runs around the change dates. A time zone converter helps with the arithmetic.

Avoid everything running at midnight

When every job on a server is set to 0 0 * * *, they all compete for resources at once. Spread heavy tasks out, for example 17 3 * * * for a backup and 42 3 * * * for a clean-up.

Steps don't carry across boundaries

*/7 in the minute field runs at 0, 7, 14 … 49, 56, and then at 0 again. The gap between 56 and 0 is only four minutes, because the step restarts every hour. If you need a true fixed interval that does not divide evenly into 60, use a scheduler that supports intervals, or have the script track its own last run.

Log timestamps

When checking whether a job ran, compare log times with the server clock. A Unix timestamp converter is handy when logs store times as epoch seconds.

Frequently asked questions

What does */5 * * * * mean?

It runs every five minutes: at minute 0, 5, 10 and so on up to 55, every hour of every day. The */5 means "every value in the minute field, stepping by 5".

Is Sunday 0 or 7 in cron?

Both. Standard cron treats 0 and 7 as Sunday in the day-of-week field, and most implementations also accept the names SUN to SAT.

How do I run a cron job every weekday?

Put 1-5 in the day-of-week field, for example 0 9 * * 1-5 for 9 AM Monday to Friday. Leave the day-of-month field as * so the "either" rule does not add extra days.

Can cron run a job every 30 seconds?

Standard cron's smallest unit is one minute. A common workaround is two entries, one of which sleeps 30 seconds before running the command, but a scheduler with second-level support or a long-running service is usually cleaner.

Why didn't my cron job run?

The usual causes are a time zone mismatch, a missing path or environment variable in the command, file permissions, or the day-of-month and day-of-week "either" rule. Check the system log or your redirected output for errors.

Does the preview use my server's time zone?

No. The next run times are calculated in your browser's local time zone, so convert if your server runs in UTC or another zone.

Try it now: Cron Expression Generator

Loading tool…