−50%

50% off your first month on any paid plan · code WELCOME50 · until Nov 30

Start free →
Glossary · C

What Is a Cron Expression? Syntax, Fields, and Examples

Definitioncron expression · noun

A cron expression is a five-field string that tells a cron daemon when to execute a scheduled task.

Five fields, left to right: minute (0-59), hour (0-23), day of month (1-31), month (1-12), day of week (0-7, where 0 and 7 both mean Sunday). The syntax dates back to Version 7 Unix in 1979 and hasn't changed much since. 30 4 * * * means "run at 4:30 AM every day." 0 9 * * 1-5 means "9 AM on weekdays." That's the whole idea.

Cron expression 30 4 * * * broken down into five fields: minute (30), hour (4), day of month (every), month (every), day of week (every) — runs at 4:30 AM every day
Cron expression lifecycle: write expression, store in crontab, cron daemon checks every minute, task executes on schedule, monitor verifies execution

The five fields explained#

Every cron expression reads left to right. The first field is the most granular (minute), and the last is the broadest (day of week). Get the order wrong and a job that should run once a day at 2 AM fires once an hour at the second minute instead. I've made that mistake on a production server. The log file hit 400 MB before anyone noticed.

PositionFieldAllowed valuesExampleMeaning
1stMinute0-5930At the 30th minute
2ndHour0-2344 AM (24-hour clock)
3rdDay of month1-3115The 15th of the month
4thMonth1-12 or JAN-DEC6June
5thDay of week0-7 or SUN-SAT1Monday

Months start at 1, not 0. Days of the week start at 0 for Sunday. Both 0 and 7 mean Sunday on most systems, though some older implementations only accept 0. Three-letter names (MON, JAN) work on many systems but numeric values are more portable across platforms.

The command itself comes after the five fields in a crontab line: 30 4 * * * /path/to/script.sh. In systems like Kubernetes CronJobs or WatchCron Cloud Cron, the expression stands alone and the action is configured separately.

Special characters#

Four cron special characters explained: asterisk for every value, comma for specific values, hyphen for ranges, slash for step intervals

Four characters handle nearly every scheduling pattern. A fifth (?) shows up in extended implementations.

CharacterNameWhat it doesExampleResult
*AsteriskMatches every value in the field* * * * *Every minute
/Slash (step)Every Nth value*/15 * * * *Every 15 minutes (0, 15, 30, 45)
-Hyphen (range)Consecutive values0 9-17 * * *Top of every hour, 9 AM through 5 PM
,Comma (list)Specific values0 9,13,18 * * *At 9 AM, 1 PM, and 6 PM
?Question mark"No specific value" (Quartz, AWS only)0 0 ? * MONMidnight every Monday

You can combine them. 10-30/5 in the minute field fires at minutes 10, 15, 20, 25, and 30. 1,15 * * * * fires at minute 1 and minute 15 of every hour. But watch out for step values on ranges that don't divide evenly: */7 in the minute field produces 0, 7, 14, 21, 28, 35, 42, 49, 56. The gap between 56 and the next hour's 0 is only 4 minutes, not 7. The step resets at field boundaries.

Common cron expressions#

These cover the schedules that come up in most server environments. For 25+ additional patterns with real-world context, see the cron expression cheat sheet.

ExpressionSchedule
* * * * *Every minute
*/5 * * * *Every 5 minutes
*/10 * * * *Every 10 minutes
*/30 * * * *Every 30 minutes
0 * * * *Every hour at :00
0 */2 * * *Every 2 hours
0 0 * * *Every day at midnight
0 2 * * *Every day at 2 AM
0 9 * * 1-5Weekdays at 9 AM
0 0 * * 0Sunday at midnight
0 0 * * 1Monday at midnight
0 0 1 * *First day of every month
0 0 1 1 *January 1st at midnight
0 0 1 */3 *Quarterly (1st of every 3rd month)
0 3 * * *Every day at 3 AM

Use the cron expression validator to check any expression before deploying it. One misplaced field turns a daily job into a per-minute one.

Shorthand strings (@macros)#

Most cron implementations support shorthand aliases that map to standard five-field expressions. They're convenient, though not every platform accepts them.

ShorthandEquivalent expressionSchedule
@yearly / @annually0 0 1 1 *January 1st at midnight
@monthly0 0 1 * *1st of every month at midnight
@weekly0 0 * * 0Sunday at midnight
@daily / @midnight0 0 * * *Every day at midnight
@hourly0 * * * *Every hour at :00
@rebootn/aOnce at daemon startup

@reboot has no five-field equivalent because it doesn't describe a recurring schedule. It fires once when the cron daemon starts, which typically means after a system reboot. Kubernetes CronJobs and Docker don't support @reboot at all. GitHub Actions and AWS EventBridge ignore all shorthand strings. When portability matters, write the full expression.

The OR rule that trips everyone up#

Two fields cause most of the confusion, and both involve days. When day-of-month and day-of-week are both restricted (neither is *), standard cron treats them as OR. So 0 0 15 * 1 doesn't mean "the 15th, but only if it's a Monday." It means every 15th and every Monday. That's roughly 67 runs per year instead of 12. We've watched teams debug this for hours before realizing the schedule was doing exactly what it was told.

Step values on uneven ranges also catch people off guard. 0 0 1-30/7 * * fires on the 1st, 8th, 15th, 22nd, and 29th. Five times, not four (the range doesn't divide evenly by seven). The expression validator catches these misreads before deployment, and the visual builder skips the mental arithmetic entirely.

Common mistakes#

Three patterns account for most cron debugging sessions.

Wrong field order. The expression 0 0 * * * runs at midnight. Swap the first two fields to 0 * 0 * * and cron rejects it (day 0 doesn't exist) or interprets it in ways you didn't intend. Minute always comes first. If you're second-guessing the order, the builder tool removes the ambiguity.

The midnight stampede. Setting every daily job to 0 0 * * * stacks them all at midnight. If three of those jobs hit the same database, the first one might take 90 seconds instead of 15. Stagger start times: backups at 2 AM, reports at 2:30, cleanups at 3:00. I've personally triaged a production incident caused by exactly this. The site became unresponsive because four large queries collided at midnight, and the connection pool ran dry.

Assuming AND when cron means OR. Covered above, but it's worth repeating because it generates the most confused support tickets. 0 0 1 * 5 fires on the 1st of every month and every Friday. That's roughly 56 runs a year. If you wanted "the first Friday of every month," cron can't express that natively. Use 0 0 1-7 * * and add a weekday check inside the script: [ "$(date +\%u)" = 5 ] && /path/to/job.sh.

Not all cron is the same cron#

Three cron variants compared: standard 5-field (Linux, Kubernetes, GitHub Actions), Quartz 6-field with seconds, AWS EventBridge 6-field with year

The five-field format is standard on Linux, macOS, and most Unix systems. But implementations diverge once you leave that baseline.

PlatformFieldsExtra featuresTimezone
Linux crontab5@daily, @rebootSystem TZ or CRON_TZ
Quartz (Java)6-7 (adds seconds, optional year)L, W, #, ?Configurable per trigger
Kubernetes CronJob5timeZone field (v1.27+)UTC default
AWS EventBridge6 (adds year)L, W, ?UTC only
GitHub Actions5No shorthandUTC only
systemd timersDifferent syntaxOnCalendar=*-*-01 02:00:00System TZ
LaravelFluent API->dailyAt('04:30') → 30 4 * * *App TZ

Quartz adds L (last day of month), W (nearest weekday), and # (Nth weekday: MON#1 = first Monday). These don't exist in standard cron. If you're copying an expression from a Quartz tutorial into a crontab, the extra field or special characters will cause a silent failure or a cryptic parse error. The timezone converter helps when migrating expressions between platforms that handle timezones differently.

Monitoring needs the expression#

A cron monitor parses the expression to know when a job should've run. Without it, the monitor can only do heartbeat checks ("expect a ping every 5 minutes"), which can't distinguish between a job scheduled for 4:30 AM that fired at 4:30 AM and one that silently skipped. WatchCron takes the full expression, calculates the next expected run, adds a grace period for drift, and alerts you if the window closes empty. The cron calculator shows how many times an expression fires per day, week, and year, so you can verify the math before wiring up the monitor.

This is where the five-field syntax earns its keep. A monitoring system that understands 0 3 * * 1 knows the job runs at 3 AM on Mondays. It won't send false alarms on Tuesday or flag a 90-second delay as a missed run. Expression-aware monitoring reduces noise by an order of magnitude compared to fixed-interval heartbeats. Healthchecks.io and Cronitor both parse cron expressions natively. Better Stack uses interval-based detection, which works for regular schedules but generates false positives on irregular ones (first-of-month, bi-weekly).

See our cron expression cheat sheet for 25+ copy-paste examples, or browse 400+ cron expression examples by category.

Related terms: cron job, timeout, health check, SLA, runbook

Frequently asked

A cron expression is a five-field string that defines a schedule for automated tasks on Unix-like systems. The fields represent minute, hour, day of month, month, and day of week. For example, 0 9 * * 1-5 means 9:00 AM every weekday. The syntax originated in Version 7 Unix (1979) and is used by crontab, Kubernetes CronJobs, CI/CD pipelines, and cloud schedulers.

Standard Unix cron uses five fields: minute, hour, day of month, month, and day of week. Quartz (Java) adds a sixth field for seconds at the beginning. AWS EventBridge uses six fields with an added year field at the end. systemd timers use a completely different syntax (OnCalendar) instead of cron fields.

An asterisk (*) matches every possible value for that field. In the minute field, * means every minute (0-59). In the month field, * means every month (1-12). It is the default wildcard that says "no restriction on this field."

They produce different results. */5 in the minute field means every 5 minutes starting from 0 (minutes 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55 — twelve runs per hour). The list 0,5,10,15 only fires at those four specific minutes. The step syntax covers the full range automatically, while the comma syntax fires only at the listed values.

In standard cron, when both fields are restricted (neither is *), they combine with OR logic. The expression 0 0 15 * 1 fires on the 15th of every month AND every Monday, not only on Mondays that fall on the 15th. This produces roughly 67 runs per year instead of 12. Some implementations like Quartz use AND logic instead, so the same expression behaves differently across platforms.

A cron expression defines WHEN a task runs. crontab (cron table) is the file that stores cron expressions along with the commands they trigger. You edit the crontab with 'crontab -e'. Each line in a crontab contains a five-field cron expression followed by the command to execute.

No. The minimum resolution in standard cron is one minute. For sub-minute scheduling, use systemd timers (which support second-level precision), a sleep loop inside a per-minute cron job, or a task scheduler like Quartz that supports a seconds field. Cloud schedulers like WatchCron and most cron services also use one-minute minimum intervals.

Both. Standard cron accepts 0 and 7 as Sunday. This is defined in the POSIX specification. Most implementations also accept three-letter abbreviations (SUN, MON, TUE). For maximum portability, use 0 for Sunday, as some older systems do not recognize 7.

Start monitoring in under 2 minutes.

Free plan includes 20 checks · No credit card required
Pricing Docs
Log in Start free →