DevToolbox

Cron Expressions Explained with Examples (Every Field, Step, and Range)

By Editorial team · 2026-06-14

In short: A standard cron expression has five space-separated fields — minute, hour, day-of-month, month, day-of-week — that together define when a job runs. Use * for 'every', */n for steps, a-b for ranges, and a,b for lists. The classic trap is day-of-month and day-of-week: when both are set, most crons run the job if EITHER matches, not both.

Cron is the scheduler that runs jobs at fixed times on Unix-like systems and powers the schedule syntax in countless CI pipelines, cloud functions, and container platforms. A cron expression is the compact string that says when. Once you learn its five fields and a few special characters, you can read any schedule at a glance. This guide is a practical reference with copy-ready examples.

What do the five cron fields mean?

A standard cron expression is five space-separated fields, read left to right:

┌───────── minute (0-59)
│ ┌─────── hour (0-23)
│ │ ┌───── day of month (1-31)
│ │ │ ┌─── month (1-12)
│ │ │ │ ┌─ day of week (0-6, Sun=0)
│ │ │ │ │
* * * * *

A field matches when the current time value falls in it. The job runs only when all five fields match at the same minute (with one important exception for the two “day” fields, covered below).

FieldAllowed valuesNotes
Minute0–59
Hour0–2324-hour clock
Day of month1–31
Month1–12or JANDEC
Day of week0–60 and 7 = Sunday; or SUNSAT

What do the special characters mean?

Four characters do almost all the work:

SymbolNameMeaningExample
*WildcardEvery value in the field* * * * * = every minute
,ListSeveral specific values0,30 = at :00 and :30
-RangeA contiguous span9-17 = 9 through 17
/StepEvery nth value*/15 = every 15 units

Steps combine with ranges and wildcards: 0-30/10 in the minute field means minutes 0, 10, 20, 30.

Ready-to-copy cron examples

ExpressionRuns
* * * * *Every minute
*/5 * * * *Every 5 minutes
0 * * * *Every hour, on the hour
0 9 * * *Every day at 09:00
30 8 * * 1-508:30, Monday–Friday
0 0 * * 0Midnight every Sunday
0 0 1 * *Midnight on the 1st of each month
0 0 1 1 *Midnight on 1 January (yearly)
*/10 9-17 * * 1-5Every 10 min, 9am–5pm, weekdays
15 2 * * 602:15 every Saturday

What is the day-of-month vs. day-of-week trap?

This is the single most common cron bug. When both the day-of-month (field 3) and day-of-week (field 5) are restricted (neither is *), the traditional Vixie cron behaviour is an OR, not an AND. The job runs when either field matches.

So 0 0 1 * 1 does not mean “midnight on a Monday that is also the 1st.” It means “midnight on the 1st of the month and midnight every Monday.” If you truly need “the 1st and a Monday,” you cannot express it in one standard cron line — you typically add a guard in the job itself (check the date and exit early).

The safe rule: keep at least one of the two day fields as * unless you understand the OR semantics.

Timezones, seconds, and dialects

Cron syntax is not perfectly universal — watch for these differences:

A workflow for writing a cron schedule

  1. Write the time in words first — “every weekday at 8:30am.”
  2. Fill the fields right to left: day-of-week (1-5), month (*), day-of-month (*), hour (8), minute (30) → 30 8 * * 1-5.
  3. Avoid the day trap: keep one day field as *.
  4. Confirm the timezone your scheduler uses.
  5. Test the next few run times before deploying.

Cron schedules often coordinate jobs that generate IDs and timestamps — if your pipeline stamps records, see UUID v4 vs v7 for time-ordered identifiers, and the Unix timestamp converter for translating epoch values your jobs emit.

Sources

Frequently asked questions

What are the five fields in a cron expression?

In order: minute (0-59), hour (0-23), day of month (1-31), month (1-12), and day of week (0-6, where 0 and 7 both mean Sunday). Each field accepts *, ranges, lists, and steps.

What does */5 mean in cron?

It is a step value meaning 'every 5 units' across the whole range of that field. In the minute field, */5 fires at minutes 0, 5, 10, 15, and so on — i.e. every five minutes.

Does cron use my local time or UTC?

It depends on the system. Traditional Unix cron uses the server's local timezone, while many cloud schedulers and managed cron services default to UTC. Always confirm the timezone, especially around daylight-saving changes.

Why did my job run twice or on the wrong day?

The most common cause is setting both day-of-month and day-of-week to non-* values. In Vixie cron the job runs when EITHER field matches, so '0 0 1 * 1' runs on the 1st AND every Monday, not only on a Monday the 1st.

Related articles

Last updated: 2026-06-14