Skip to content
CronChief

Cron syntax explained: the complete guide

The five fields, every special character, ranges, lists, steps, macros and the optional seconds field — everything you need to read and write a cron expression with confidence.

A cron expression is a compact string that tells a scheduler when to run a job. It looks cryptic at first, but it's built from just five fields and a handful of symbols. Once you can read the fields, every expression becomes obvious.

The five fields

A standard cron expression has five space-separated fields, in this order:

Field Allowed values Meaning
Minute 0–59 Minute of the hour
Hour 0–23 Hour of the day (24-hour clock)
Day of month 1–31 Day of the month
Month 1–12 (or JAN–DEC) Month of the year
Day of week 0–6 (or SUN–SAT) Day of the week, Sunday = 0

So 30 9 * * 1 reads left to right as: minute 30, hour 9, any day of the month, any month, day-of-week 1 (Monday) — 9:30 AM every Monday.

A useful mental picture:

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

The special characters

Each field accepts four building blocks. Learn these and you can read anything.

Asterisk * — every value

An asterisk means "every value for this field". * * * * * runs every minute because every field says "every". Pin a field to a number and you constrain it: 0 * * * * runs every hour (at minute 0).

Comma , — a list

A comma lists several specific values. 0 0,12 * * * runs at midnight and noon. 0 9 * * 1,3,5 runs at 9 AM on Monday, Wednesday and Friday.

Hyphen - — a range

A hyphen defines an inclusive range. 0 9-17 * * * runs every hour from 9 AM through 5 PM. 0 0 * * 1-5 runs on weekdays (Monday through Friday).

Slash / — a step

A slash defines a step, or interval. */5 * * * * runs every 5 minutes. You can combine a range with a step: 0 9-17/2 * * * runs every 2 hours between 9 AM and 5 PM.

An important subtlety: */5 means "every 5th value starting from 0", so it aligns to 0, 5, 10, …. That's different from 5, which is the single value "5".

Macros (shortcuts)

Most cron implementations accept convenience macros in place of the five fields:

Macro Equivalent Meaning
@hourly 0 * * * * Once an hour
@daily / @midnight 0 0 * * * Once a day at midnight
@weekly 0 0 * * 0 Once a week on Sunday
@monthly 0 0 1 * * Once a month on the 1st
@yearly / @annually 0 0 1 1 * Once a year on Jan 1
@reboot Once, at system startup

Macros are easier to read, but they hide the exact time. If timing matters, spell out the fields.

The optional seconds field

Classic Unix cron stops at one-minute resolution. Some schedulers — Quartz, Spring's @Scheduled, the Cronos library CronChief uses — accept a sixth field for seconds, placed at the front:

*/30 * * * * *   →  every 30 seconds

When you see six fields instead of five, the first is almost always seconds. CronChief's seconds toggle switches the tool into 6-field mode.

Putting it together

Read each field independently, then combine:

The fastest way to build confidence is to paste an expression into the cron parser and watch the plain-English description and next run times update as you edit each field. When you're ready, browse the full example library for ready-made schedules you can copy.