Cron Expression Builder: Five Fields, Steps and Common Slips

Open Tool Cron Expression Builder

Five fields, five units

Standard cron has minute, hour, day of month, month and day of week. Each accepts a value, a range, a list, a step or an asterisk: star for any, hyphen for range, comma for list, slash for step. Five-minute intervals set the minute field to star-slash-five; daily at nine sets minute zero and hour nine. Fields separate with single spaces, and stray spaces are the commonest beginner failure.

Steps

  1. Fill the five fields, or build through the guided helper.
  2. Load examples and reset as needed.
  3. Copy or download the expression.
  4. Verify on the target scheduler, since implementations differ in field count.

The day and weekday rule

When both day-of-month and day-of-week are specified, most implementations OR them: either match fires. So day fifteen plus weekday one means the fifteenth and every Monday, not the Monday that falls on the fifteenth. Weekday numbering varies too — some start at zero for Sunday, others at one for Monday, and seven may mean Sunday — so cross-platform moves need explicit checking.

Steps and ranges together

A step after a range means every nth value from the start. Star-slash-ten over minutes yields zero, ten through fifty. A range constrains the start, so hours eight to eighteen step two runs at eight, ten through eighteen. Steps are divisibility-based rather than interval-based: star-slash-seven in minutes gives zero, seven, fourteen and so on to fifty-six, then restarts at the next hour, which is unevenly spaced.

Common mistakes

Writing six fields where a seconds field comes first breaks five-field systems. Using a question mark, which extended schedulers accept and standard cron does not. Crossing month boundaries with three-day steps, which skip or repeat. Assuming local time when the server runs UTC, shifting everything by eight hours. Ignoring daylight saving, where a two-in-the-morning job may be skipped or doubled. And treating weekday ranges as holiday-aware, which needs application logic.

Where cron is the wrong tool:Sub-minute precision exceeds standard cron's granularity. Long jobs needing retries, ordering and dependencies want a workflow engine, since cron only triggers. High availability demands locking and leader election rather than a single host. Jobs that may outrun their interval need re-entry guards to avoid stacking. And audit trails or visual history exceed cron logs, which need centralised logging and alerting.

⏫︎