Don't like ads? Go Ad-Free Today

Cron Expressions Explained Writing Schedules Without Losing Your Mind

Published on

A practical reference for cron syntax: the five fields, special characters, 10 ready-to-use expressions, and a cron expression generator to build and verify your schedules without guessing.

Cron Expressions Explained: Writing Schedules Without Losing Your Mind 1
ADVERTISEMENT · REMOVE?

Cron schedules tasks on Unix-like systems. The syntax — five whitespace-separated fields — looks simple until you need to run something every 15 minutes on weekdays and can’t remember whether that’s field two or three. This is the reference you keep open.

The 5-Field Format

Every cron expression has exactly five fields, separated by spaces, in this order:

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

Fields Reference

FieldAllowed ValuesSpecial CharactersExample
Minute0–59* , – /*/15 = every 15 min
Hour0–23* , – /9-17 = 9am to 5pm
Day of Month1–31* , – / ?1 = 1st of month
Month1–12* , – /*/3 = every quarter
Day of Week0–7 (0=Sun)* , – / ?1-5 = Mon–Fri

Special Characters

  • * — wildcard, matches any value in that field
  • , — list separator: 1,3,5 in day-of-week means Monday, Wednesday, Friday
  • — range: 9-17 in the hour field means 9am through 5pm
  • / — step: */15 in the minute field means every 15 minutes; 2/3 means every 3rd value starting from 2
  • ? — no specific value (day-of-month or day-of-week only, used by Quartz/Spring schedulers)

Common Cron Expressions

ExpressionDescription
* * * * *Every minute
*/5 * * * *Every 5 minutes
*/15 * * * *Every 15 minutes
0 * * * *Every hour, on the hour
0 0 * * *Every day at midnight
0 9 * * 1-59am every weekday
0 9-17 * * 1-5Every hour from 9am–5pm, weekdays only
0 0 * * 0Every Sunday at midnight
0 0 1 * *Midnight on the 1st of each month
0 0 1 1 *Midnight on January 1st

Three Real-World Examples

1. Database backup at midnight

0 0 * * *

Minute 0, hour 0, every day. Fires once at 00:00 — clean, predictable, and out of the way during peak hours.

2. API sync every 15 minutes

*/15 * * * *

*/15 in the minute field means “step by 15, starting at 0” — fires at :00, :15, :30, and :45 of every hour. All other fields are *, so it runs around the clock.

3. Weekly cleanup — Monday at 6am

0 6 * * 1

Minute 0, hour 6, any day of month, any month, day-of-week 1 (Monday). Runs once a week. Change 1 to 5 if Fridays work better for your team.

Build and Verify Your Schedule

Memorizing every combination isn’t the point — knowing where to look is. Use the Cron Expression Generator to set fields visually and watch the expression form as you go. Once you have a candidate expression, paste it into the Cron Next Run Calculator to confirm it fires on exactly the dates and times you expect before you deploy.

Five fields, four special characters, two tools to check your work — that’s everything you need to schedule anything reliably.

Want To enjoy an ad-free experience? Go Ad-Free Today

Install Our Extensions

Add IO tools to your favorite browser for instant access and faster searching

Add to Chrome Extension Add to Edge Extension Add to Firefox Extension Add to Opera Extension

Scoreboard Has Arrived!

Scoreboard is a fun way to keep track of your games, all data is stored in your browser. More features are coming soon!

ADVERTISEMENT · REMOVE?
ADVERTISEMENT · REMOVE?
ADVERTISEMENT · REMOVE?

News Corner w/ Tech Highlights

Get Involved

Help us continue providing valuable free tools

Buy me a coffee
ADVERTISEMENT · REMOVE?