Skip to main content
SnipKit
Cron Syntax Explained: How to Schedule Tasks Like a Pro

Photo by Ocean Ng on Unsplash

Cron Syntax Explained: How to Schedule Tasks Like a Pro

SnipKit Team5 min read

Cron syntax looks cryptic — but it's just five fields. Learn the field order and four special characters, and you can write any cron schedule from memory. This guide breaks it down with real examples. Want to skip the manual work? The SnipKit Cron Expression Generator builds and validates expressions interactively.

The 5 Fields Every Cron Expression Uses

Every standard cron expression is five space-separated fields. Left to right:

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

A concrete example:

0 9 * * 1-5

Read left to right: minute 0, hour 9, any day of month, any month, Monday through Friday. That's "weekdays at 9am." Once you know the field order, most expressions become readable at a glance.

One gotcha: both 0 and 7 mean Sunday. Use 1-5 for weekdays — it works everywhere.

Special Characters: *, /, -, and ,

Four characters cover almost every cron schedule you'll ever need.

* — every value. A * in the minute field means "every minute." In the hour field, "every hour."

* * * * *   # runs every minute

/ — step interval. The slash divides a range into equal steps. */5 in the minute field means "every 5 minutes."

*/5 * * * *   # cron every 5 minutes

- — range. A hyphen selects a continuous range. 1-5 in the weekday field means Monday through Friday.

0 9 * * 1-5   # weekdays at 9am

, — list. A comma selects discrete values. 9,17 in the hour field means 9am and 5pm.

0 9,17 * * *   # twice daily: 9am and 5pm

You can combine them. */15 9-17 * * 1-5 means "every 15 minutes, between 9am and 5pm, on weekdays."

10 Cron Expressions Every Developer Needs

ExpressionWhat It Does
* * * * *Every minute
*/5 * * * *Every 5 minutes
0 * * * *Every hour, on the hour
0 0 * * *Daily at midnight
0 9 * * 1-5Weekdays at 9am
0 9 * * 1Every Monday at 9am
0 0 1 * *First of every month at midnight
*/15 9-17 * * 1-5Every 15 min during business hours
0 9,17 * * *Twice a day: 9am and 5pm
0 0 1 1,4,7,10 *Quarterly: first day of Jan, Apr, Jul, Oct

Paste any of these into the SnipKit Cron Expression Generator to see a plain-English description and the next scheduled run times.

Working with dates in your jobs? The date calculator helps reason through which dates match. The Unix timestamp converter handles epoch-to-date conversions.

Shortcut Strings: @daily, @hourly, @weekly

Most cron implementations accept named shortcuts as shorthand for common schedules.

ShortcutEquivalentRuns
@yearly0 0 1 1 *January 1st at midnight
@monthly0 0 1 * *1st of each month at midnight
@weekly0 0 * * 0Every Sunday at midnight
@daily0 0 * * *Every day at midnight
@hourly0 * * * *Every hour, on the hour
@rebootOnce, on startup

These are readable and hard to mistype. Use them when the exact minute doesn't matter.

Note: @reboot isn't available everywhere. Cloud schedulers (AWS EventBridge, Vercel Cron, GitHub Actions) sometimes add a sixth field or use slightly different rules. Always check your platform's docs.

FAQ

What are the 5 fields in a cron expression?

Left to right: minute (0-59), hour (0-23), day of month (1-31), month (1-12), and day of week (0-7, where 0 and 7 both mean Sunday). A * means "every value." Example: 0 9 * * * = "every day at 9am."

How do I write a cron job that runs every 5 minutes?

Use the step operator: */5 * * * *. The /5 steps through the minute range in increments of five — minutes 0, 5, 10, 15, and so on. The remaining * fields mean every hour, day, month, and weekday. For business hours only: */5 9-17 * * 1-5. Try it in the cron expression generator to see exact run times.

What is the difference between cron and crontab?

Cron is the daemon — the background service that fires jobs on schedule. Crontab (cron table) is the config file holding those schedules, one per line. Edit it with crontab -e. A "cron job" is a single entry in that file.

Stop Googling the Field Order

Five fields, four special characters — that covers 95% of schedules. The rest is just combinations.

The SnipKit Cron Expression Generator lets you build any schedule visually, with plain-English confirmation and next run times. Bookmark it and stop guessing.